1 (function(e, a) { for(var i in a) e[i] = a[i]; if(a.__esModule) Object.defineProperty(e, "__esModule", { value: true }); }(exports,
2 /******/ (() => { // webpackBootstrap
3 /******/ var __webpack_modules__ = ([
5 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
9 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10 if (k2 === undefined) k2 = k;
11 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12 }) : (function(o, m, k, k2) {
13 if (k2 === undefined) k2 = k;
16 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17 Object.defineProperty(o, "default", { enumerable: true, value: v });
21 var __importStar = (this && this.__importStar) || function (mod) {
22 if (mod && mod.__esModule) return mod;
24 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25 __setModuleDefault(result, mod);
28 Object.defineProperty(exports, "__esModule", ({ value: true }));
29 exports.activate = void 0;
30 const coc_nvim_1 = __webpack_require__(1);
31 const path_1 = __webpack_require__(2);
32 const cmds = __importStar(__webpack_require__(3));
33 const ctx_1 = __webpack_require__(33);
34 const file_status_1 = __webpack_require__(36);
35 const install = __importStar(__webpack_require__(37));
36 async function activate(context) {
38 const ctx = new ctx_1.Ctx(context);
39 if (!ctx.config.enabled) {
42 for (const service of coc_nvim_1.services.getServiceStats()) {
43 if (service.id.includes('clangd')) {
44 coc_nvim_1.workspace.showMessage(`Looks like you've configured clangd in coc-settings.json, you should remove it to use coc-clangd`, 'warning');
48 const clangdPath = await install.activate(context);
53 await ctx.startServer(clangdPath);
58 const fileStatus = new file_status_1.FileStatus();
59 const fileWatcher = coc_nvim_1.workspace.createFileSystemWatcher('**/{compile_commands.json,compile_flags.txt}');
60 fileWatcher.onDidChange((e) => reload(e.fsPath, ctx, context));
61 fileWatcher.onDidCreate((e) => reload(e.fsPath, ctx, context));
62 context.subscriptions.push(fileWatcher, fileStatus, coc_nvim_1.commands.registerCommand('clangd.switchSourceHeader', cmds.switchSourceHeader(ctx)), coc_nvim_1.commands.registerCommand('clangd.symbolInfo', cmds.symbolInfo(ctx)), ctx.client.onDidChangeState((e) => {
64 if (e.newState === coc_nvim_1.State.Running) {
65 (_a = ctx.client) === null || _a === void 0 ? void 0 : _a.onNotification('textDocument/clangd.fileStatus', (status) => {
66 fileStatus.onFileUpdated(status);
69 else if (e.newState === coc_nvim_1.State.Stopped) {
72 }), coc_nvim_1.workspace.onDidOpenTextDocument(() => {
73 fileStatus.updateStatus();
75 (_a = ctx.client) === null || _a === void 0 ? void 0 : _a.onNotification('textDocument/clangd.fileStatus', (status) => {
76 fileStatus.onFileUpdated(status);
79 exports.activate = activate;
80 async function reload(url, ctx, context) {
81 const notification = ctx.config.showDBChangedNotification;
83 const msg = `${path_1.basename(url)} has changed, clangd is reloading...`;
84 coc_nvim_1.workspace.showMessage(msg);
86 for (const sub of ctx.subscriptions) {
94 await activate(context);
96 coc_nvim_1.workspace.showMessage(`clangd has reloaded`);
105 module.exports = require("coc.nvim");;
112 module.exports = require("path");;
116 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
120 Object.defineProperty(exports, "__esModule", ({ value: true }));
121 exports.symbolInfo = exports.switchSourceHeader = void 0;
122 const coc_nvim_1 = __webpack_require__(1);
123 const vscode_languageserver_protocol_1 = __webpack_require__(4);
124 var SwitchSourceHeaderRequest;
125 (function (SwitchSourceHeaderRequest) {
126 SwitchSourceHeaderRequest.type = new vscode_languageserver_protocol_1.RequestType('textDocument/switchSourceHeader');
127 })(SwitchSourceHeaderRequest || (SwitchSourceHeaderRequest = {}));
128 var SymbolInfoRequest;
129 (function (SymbolInfoRequest) {
130 SymbolInfoRequest.type = new vscode_languageserver_protocol_1.RequestType('textDocument/symbolInfo');
131 })(SymbolInfoRequest || (SymbolInfoRequest = {}));
132 function switchSourceHeader(ctx) {
137 const doc = await coc_nvim_1.workspace.document;
144 const dest = await ctx.client.sendRequest(SwitchSourceHeaderRequest.type.method, params);
146 coc_nvim_1.workspace.showMessage(`Didn't find a corresponding file.`);
149 await coc_nvim_1.workspace.jumpTo(dest);
152 exports.switchSourceHeader = switchSourceHeader;
153 function symbolInfo(ctx) {
158 const doc = await coc_nvim_1.workspace.document;
162 const position = await coc_nvim_1.workspace.getCursorPosition();
164 textDocument: { uri: doc.uri },
167 const details = await ctx.client.sendRequest(SymbolInfoRequest.type.method, params);
168 if (!details.length) {
172 const detail = details[0];
173 coc_nvim_1.workspace.showMessage(`name: ${detail.name}, containerName: ${detail.containerName}, usr: ${detail.usr}`);
176 exports.symbolInfo = symbolInfo;
181 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
184 /* --------------------------------------------------------------------------------------------
\r
185 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
186 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
187 * ------------------------------------------------------------------------------------------ */
\r
189 function __export(m) {
\r
190 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
\r
192 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
193 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
194 exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;
\r
195 exports.ResponseError = vscode_jsonrpc_1.ResponseError;
\r
196 exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;
\r
197 exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;
\r
198 exports.Disposable = vscode_jsonrpc_1.Disposable;
\r
199 exports.Event = vscode_jsonrpc_1.Event;
\r
200 exports.Emitter = vscode_jsonrpc_1.Emitter;
\r
201 exports.Trace = vscode_jsonrpc_1.Trace;
\r
202 exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;
\r
203 exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;
\r
204 exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;
\r
205 exports.RequestType = vscode_jsonrpc_1.RequestType;
\r
206 exports.RequestType0 = vscode_jsonrpc_1.RequestType0;
\r
207 exports.NotificationType = vscode_jsonrpc_1.NotificationType;
\r
208 exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;
\r
209 exports.MessageReader = vscode_jsonrpc_1.MessageReader;
\r
210 exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;
\r
211 exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;
\r
212 exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;
\r
213 exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;
\r
214 exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;
\r
215 exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;
\r
216 exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;
\r
217 exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;
\r
218 exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;
\r
219 exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;
\r
220 exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;
\r
221 exports.ProgressType = vscode_jsonrpc_1.ProgressType;
\r
222 __export(__webpack_require__(18));
\r
223 __export(__webpack_require__(19));
\r
224 const callHierarchy = __webpack_require__(31);
\r
225 const st = __webpack_require__(32);
\r
227 (function (Proposed) {
\r
228 let CallHierarchyPrepareRequest;
\r
229 (function (CallHierarchyPrepareRequest) {
\r
230 CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;
\r
231 CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;
\r
232 })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));
\r
233 let CallHierarchyIncomingCallsRequest;
\r
234 (function (CallHierarchyIncomingCallsRequest) {
\r
235 CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;
\r
236 CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;
\r
237 })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));
\r
238 let CallHierarchyOutgoingCallsRequest;
\r
239 (function (CallHierarchyOutgoingCallsRequest) {
\r
240 CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;
\r
241 CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;
\r
242 })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));
\r
243 Proposed.SemanticTokenTypes = st.SemanticTokenTypes;
\r
244 Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;
\r
245 Proposed.SemanticTokens = st.SemanticTokens;
\r
246 let SemanticTokensRequest;
\r
247 (function (SemanticTokensRequest) {
\r
248 SemanticTokensRequest.method = st.SemanticTokensRequest.method;
\r
249 SemanticTokensRequest.type = st.SemanticTokensRequest.type;
\r
250 })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));
\r
251 let SemanticTokensEditsRequest;
\r
252 (function (SemanticTokensEditsRequest) {
\r
253 SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;
\r
254 SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;
\r
255 })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));
\r
256 let SemanticTokensRangeRequest;
\r
257 (function (SemanticTokensRangeRequest) {
\r
258 SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;
\r
259 SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;
\r
260 })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));
\r
261 })(Proposed = exports.Proposed || (exports.Proposed = {}));
\r
262 function createProtocolConnection(reader, writer, logger, strategy) {
\r
263 return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);
\r
265 exports.createProtocolConnection = createProtocolConnection;
\r
270 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
273 /* --------------------------------------------------------------------------------------------
\r
274 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
275 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
276 * ------------------------------------------------------------------------------------------ */
\r
277 /// <reference path="../typings/thenable.d.ts" />
\r
279 function __export(m) {
\r
280 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
\r
282 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
283 const Is = __webpack_require__(6);
\r
284 const messages_1 = __webpack_require__(7);
\r
285 exports.RequestType = messages_1.RequestType;
\r
286 exports.RequestType0 = messages_1.RequestType0;
\r
287 exports.RequestType1 = messages_1.RequestType1;
\r
288 exports.RequestType2 = messages_1.RequestType2;
\r
289 exports.RequestType3 = messages_1.RequestType3;
\r
290 exports.RequestType4 = messages_1.RequestType4;
\r
291 exports.RequestType5 = messages_1.RequestType5;
\r
292 exports.RequestType6 = messages_1.RequestType6;
\r
293 exports.RequestType7 = messages_1.RequestType7;
\r
294 exports.RequestType8 = messages_1.RequestType8;
\r
295 exports.RequestType9 = messages_1.RequestType9;
\r
296 exports.ResponseError = messages_1.ResponseError;
\r
297 exports.ErrorCodes = messages_1.ErrorCodes;
\r
298 exports.NotificationType = messages_1.NotificationType;
\r
299 exports.NotificationType0 = messages_1.NotificationType0;
\r
300 exports.NotificationType1 = messages_1.NotificationType1;
\r
301 exports.NotificationType2 = messages_1.NotificationType2;
\r
302 exports.NotificationType3 = messages_1.NotificationType3;
\r
303 exports.NotificationType4 = messages_1.NotificationType4;
\r
304 exports.NotificationType5 = messages_1.NotificationType5;
\r
305 exports.NotificationType6 = messages_1.NotificationType6;
\r
306 exports.NotificationType7 = messages_1.NotificationType7;
\r
307 exports.NotificationType8 = messages_1.NotificationType8;
\r
308 exports.NotificationType9 = messages_1.NotificationType9;
\r
309 const messageReader_1 = __webpack_require__(8);
\r
310 exports.MessageReader = messageReader_1.MessageReader;
\r
311 exports.StreamMessageReader = messageReader_1.StreamMessageReader;
\r
312 exports.IPCMessageReader = messageReader_1.IPCMessageReader;
\r
313 exports.SocketMessageReader = messageReader_1.SocketMessageReader;
\r
314 const messageWriter_1 = __webpack_require__(10);
\r
315 exports.MessageWriter = messageWriter_1.MessageWriter;
\r
316 exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;
\r
317 exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;
\r
318 exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;
\r
319 const events_1 = __webpack_require__(9);
\r
320 exports.Disposable = events_1.Disposable;
\r
321 exports.Event = events_1.Event;
\r
322 exports.Emitter = events_1.Emitter;
\r
323 const cancellation_1 = __webpack_require__(11);
\r
324 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;
\r
325 exports.CancellationToken = cancellation_1.CancellationToken;
\r
326 const linkedMap_1 = __webpack_require__(12);
\r
327 __export(__webpack_require__(13));
\r
328 __export(__webpack_require__(17));
\r
329 var CancelNotification;
\r
330 (function (CancelNotification) {
\r
331 CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');
\r
332 })(CancelNotification || (CancelNotification = {}));
\r
333 var ProgressNotification;
\r
334 (function (ProgressNotification) {
\r
335 ProgressNotification.type = new messages_1.NotificationType('$/progress');
\r
336 })(ProgressNotification || (ProgressNotification = {}));
\r
337 class ProgressType {
\r
341 exports.ProgressType = ProgressType;
\r
342 exports.NullLogger = Object.freeze({
\r
349 (function (Trace) {
\r
350 Trace[Trace["Off"] = 0] = "Off";
\r
351 Trace[Trace["Messages"] = 1] = "Messages";
\r
352 Trace[Trace["Verbose"] = 2] = "Verbose";
\r
353 })(Trace = exports.Trace || (exports.Trace = {}));
\r
354 (function (Trace) {
\r
355 function fromString(value) {
\r
356 if (!Is.string(value)) {
\r
359 value = value.toLowerCase();
\r
364 return Trace.Messages;
\r
366 return Trace.Verbose;
\r
371 Trace.fromString = fromString;
\r
372 function toString(value) {
\r
376 case Trace.Messages:
\r
378 case Trace.Verbose:
\r
384 Trace.toString = toString;
\r
385 })(Trace = exports.Trace || (exports.Trace = {}));
\r
387 (function (TraceFormat) {
\r
388 TraceFormat["Text"] = "text";
\r
389 TraceFormat["JSON"] = "json";
\r
390 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
\r
391 (function (TraceFormat) {
\r
392 function fromString(value) {
\r
393 value = value.toLowerCase();
\r
394 if (value === 'json') {
\r
395 return TraceFormat.JSON;
\r
398 return TraceFormat.Text;
\r
401 TraceFormat.fromString = fromString;
\r
402 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
\r
403 var SetTraceNotification;
\r
404 (function (SetTraceNotification) {
\r
405 SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');
\r
406 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));
\r
407 var LogTraceNotification;
\r
408 (function (LogTraceNotification) {
\r
409 LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');
\r
410 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));
\r
411 var ConnectionErrors;
\r
412 (function (ConnectionErrors) {
\r
414 * The connection is closed.
\r
416 ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";
\r
418 * The connection got disposed.
\r
420 ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";
\r
422 * The connection is already in listening mode.
\r
424 ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";
\r
425 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));
\r
426 class ConnectionError extends Error {
\r
427 constructor(code, message) {
\r
430 Object.setPrototypeOf(this, ConnectionError.prototype);
\r
433 exports.ConnectionError = ConnectionError;
\r
434 var ConnectionStrategy;
\r
435 (function (ConnectionStrategy) {
\r
436 function is(value) {
\r
437 let candidate = value;
\r
438 return candidate && Is.func(candidate.cancelUndispatched);
\r
440 ConnectionStrategy.is = is;
\r
441 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));
\r
442 var ConnectionState;
\r
443 (function (ConnectionState) {
\r
444 ConnectionState[ConnectionState["New"] = 1] = "New";
\r
445 ConnectionState[ConnectionState["Listening"] = 2] = "Listening";
\r
446 ConnectionState[ConnectionState["Closed"] = 3] = "Closed";
\r
447 ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";
\r
448 })(ConnectionState || (ConnectionState = {}));
\r
449 function _createMessageConnection(messageReader, messageWriter, logger, strategy) {
\r
450 let sequenceNumber = 0;
\r
451 let notificationSquenceNumber = 0;
\r
452 let unknownResponseSquenceNumber = 0;
\r
453 const version = '2.0';
\r
454 let starRequestHandler = undefined;
\r
455 let requestHandlers = Object.create(null);
\r
456 let starNotificationHandler = undefined;
\r
457 let notificationHandlers = Object.create(null);
\r
458 let progressHandlers = new Map();
\r
460 let messageQueue = new linkedMap_1.LinkedMap();
\r
461 let responsePromises = Object.create(null);
\r
462 let requestTokens = Object.create(null);
\r
463 let trace = Trace.Off;
\r
464 let traceFormat = TraceFormat.Text;
\r
466 let state = ConnectionState.New;
\r
467 let errorEmitter = new events_1.Emitter();
\r
468 let closeEmitter = new events_1.Emitter();
\r
469 let unhandledNotificationEmitter = new events_1.Emitter();
\r
470 let unhandledProgressEmitter = new events_1.Emitter();
\r
471 let disposeEmitter = new events_1.Emitter();
\r
472 function createRequestQueueKey(id) {
\r
473 return 'req-' + id.toString();
\r
475 function createResponseQueueKey(id) {
\r
477 return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();
\r
480 return 'res-' + id.toString();
\r
483 function createNotificationQueueKey() {
\r
484 return 'not-' + (++notificationSquenceNumber).toString();
\r
486 function addMessageToQueue(queue, message) {
\r
487 if (messages_1.isRequestMessage(message)) {
\r
488 queue.set(createRequestQueueKey(message.id), message);
\r
490 else if (messages_1.isResponseMessage(message)) {
\r
491 queue.set(createResponseQueueKey(message.id), message);
\r
494 queue.set(createNotificationQueueKey(), message);
\r
497 function cancelUndispatched(_message) {
\r
500 function isListening() {
\r
501 return state === ConnectionState.Listening;
\r
503 function isClosed() {
\r
504 return state === ConnectionState.Closed;
\r
506 function isDisposed() {
\r
507 return state === ConnectionState.Disposed;
\r
509 function closeHandler() {
\r
510 if (state === ConnectionState.New || state === ConnectionState.Listening) {
\r
511 state = ConnectionState.Closed;
\r
512 closeEmitter.fire(undefined);
\r
514 // If the connection is disposed don't sent close events.
\r
516 function readErrorHandler(error) {
\r
517 errorEmitter.fire([error, undefined, undefined]);
\r
519 function writeErrorHandler(data) {
\r
520 errorEmitter.fire(data);
\r
522 messageReader.onClose(closeHandler);
\r
523 messageReader.onError(readErrorHandler);
\r
524 messageWriter.onClose(closeHandler);
\r
525 messageWriter.onError(writeErrorHandler);
\r
526 function triggerMessageQueue() {
\r
527 if (timer || messageQueue.size === 0) {
\r
530 timer = setImmediate(() => {
\r
532 processMessageQueue();
\r
535 function processMessageQueue() {
\r
536 if (messageQueue.size === 0) {
\r
539 let message = messageQueue.shift();
\r
541 if (messages_1.isRequestMessage(message)) {
\r
542 handleRequest(message);
\r
544 else if (messages_1.isNotificationMessage(message)) {
\r
545 handleNotification(message);
\r
547 else if (messages_1.isResponseMessage(message)) {
\r
548 handleResponse(message);
\r
551 handleInvalidMessage(message);
\r
555 triggerMessageQueue();
\r
558 let callback = (message) => {
\r
560 // We have received a cancellation message. Check if the message is still in the queue
\r
561 // and cancel it if allowed to do so.
\r
562 if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
\r
563 let key = createRequestQueueKey(message.params.id);
\r
564 let toCancel = messageQueue.get(key);
\r
565 if (messages_1.isRequestMessage(toCancel)) {
\r
566 let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
\r
567 if (response && (response.error !== void 0 || response.result !== void 0)) {
\r
568 messageQueue.delete(key);
\r
569 response.id = toCancel.id;
\r
570 traceSendingResponse(response, message.method, Date.now());
\r
571 messageWriter.write(response);
\r
576 addMessageToQueue(messageQueue, message);
\r
579 triggerMessageQueue();
\r
582 function handleRequest(requestMessage) {
\r
583 if (isDisposed()) {
\r
584 // we return here silently since we fired an event when the
\r
585 // connection got disposed.
\r
588 function reply(resultOrError, method, startTime) {
\r
591 id: requestMessage.id
\r
593 if (resultOrError instanceof messages_1.ResponseError) {
\r
594 message.error = resultOrError.toJson();
\r
597 message.result = resultOrError === void 0 ? null : resultOrError;
\r
599 traceSendingResponse(message, method, startTime);
\r
600 messageWriter.write(message);
\r
602 function replyError(error, method, startTime) {
\r
605 id: requestMessage.id,
\r
606 error: error.toJson()
\r
608 traceSendingResponse(message, method, startTime);
\r
609 messageWriter.write(message);
\r
611 function replySuccess(result, method, startTime) {
\r
612 // The JSON RPC defines that a response must either have a result or an error
\r
613 // So we can't treat undefined as a valid response result.
\r
614 if (result === void 0) {
\r
619 id: requestMessage.id,
\r
622 traceSendingResponse(message, method, startTime);
\r
623 messageWriter.write(message);
\r
625 traceReceivedRequest(requestMessage);
\r
626 let element = requestHandlers[requestMessage.method];
\r
628 let requestHandler;
\r
630 type = element.type;
\r
631 requestHandler = element.handler;
\r
633 let startTime = Date.now();
\r
634 if (requestHandler || starRequestHandler) {
\r
635 let cancellationSource = new cancellation_1.CancellationTokenSource();
\r
636 let tokenKey = String(requestMessage.id);
\r
637 requestTokens[tokenKey] = cancellationSource;
\r
640 if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {
\r
641 handlerResult = requestHandler
\r
642 ? requestHandler(cancellationSource.token)
\r
643 : starRequestHandler(requestMessage.method, cancellationSource.token);
\r
645 else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {
\r
646 handlerResult = requestHandler
\r
647 ? requestHandler(...requestMessage.params, cancellationSource.token)
\r
648 : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);
\r
651 handlerResult = requestHandler
\r
652 ? requestHandler(requestMessage.params, cancellationSource.token)
\r
653 : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
\r
655 let promise = handlerResult;
\r
656 if (!handlerResult) {
\r
657 delete requestTokens[tokenKey];
\r
658 replySuccess(handlerResult, requestMessage.method, startTime);
\r
660 else if (promise.then) {
\r
661 promise.then((resultOrError) => {
\r
662 delete requestTokens[tokenKey];
\r
663 reply(resultOrError, requestMessage.method, startTime);
\r
665 delete requestTokens[tokenKey];
\r
666 if (error instanceof messages_1.ResponseError) {
\r
667 replyError(error, requestMessage.method, startTime);
\r
669 else if (error && Is.string(error.message)) {
\r
670 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
\r
673 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
\r
678 delete requestTokens[tokenKey];
\r
679 reply(handlerResult, requestMessage.method, startTime);
\r
683 delete requestTokens[tokenKey];
\r
684 if (error instanceof messages_1.ResponseError) {
\r
685 reply(error, requestMessage.method, startTime);
\r
687 else if (error && Is.string(error.message)) {
\r
688 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
\r
691 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
\r
696 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
\r
699 function handleResponse(responseMessage) {
\r
700 if (isDisposed()) {
\r
701 // See handle request.
\r
704 if (responseMessage.id === null) {
\r
705 if (responseMessage.error) {
\r
706 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);
\r
709 logger.error(`Received response message without id. No further error information provided.`);
\r
713 let key = String(responseMessage.id);
\r
714 let responsePromise = responsePromises[key];
\r
715 traceReceivedResponse(responseMessage, responsePromise);
\r
716 if (responsePromise) {
\r
717 delete responsePromises[key];
\r
719 if (responseMessage.error) {
\r
720 let error = responseMessage.error;
\r
721 responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
\r
723 else if (responseMessage.result !== void 0) {
\r
724 responsePromise.resolve(responseMessage.result);
\r
727 throw new Error('Should never happen.');
\r
731 if (error.message) {
\r
732 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
\r
735 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
\r
741 function handleNotification(message) {
\r
742 if (isDisposed()) {
\r
743 // See handle request.
\r
746 let type = undefined;
\r
747 let notificationHandler;
\r
748 if (message.method === CancelNotification.type.method) {
\r
749 notificationHandler = (params) => {
\r
750 let id = params.id;
\r
751 let source = requestTokens[String(id)];
\r
758 let element = notificationHandlers[message.method];
\r
760 notificationHandler = element.handler;
\r
761 type = element.type;
\r
764 if (notificationHandler || starNotificationHandler) {
\r
766 traceReceivedNotification(message);
\r
767 if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {
\r
768 notificationHandler ? notificationHandler() : starNotificationHandler(message.method);
\r
770 else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {
\r
771 notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);
\r
774 notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);
\r
778 if (error.message) {
\r
779 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
\r
782 logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
\r
787 unhandledNotificationEmitter.fire(message);
\r
790 function handleInvalidMessage(message) {
\r
792 logger.error('Received empty message.');
\r
795 logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);
\r
796 // Test whether we find an id to reject the promise
\r
797 let responseMessage = message;
\r
798 if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {
\r
799 let key = String(responseMessage.id);
\r
800 let responseHandler = responsePromises[key];
\r
801 if (responseHandler) {
\r
802 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));
\r
806 function traceSendingRequest(message) {
\r
807 if (trace === Trace.Off || !tracer) {
\r
810 if (traceFormat === TraceFormat.Text) {
\r
811 let data = undefined;
\r
812 if (trace === Trace.Verbose && message.params) {
\r
813 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
815 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
\r
818 logLSPMessage('send-request', message);
\r
821 function traceSendingNotification(message) {
\r
822 if (trace === Trace.Off || !tracer) {
\r
825 if (traceFormat === TraceFormat.Text) {
\r
826 let data = undefined;
\r
827 if (trace === Trace.Verbose) {
\r
828 if (message.params) {
\r
829 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
832 data = 'No parameters provided.\n\n';
\r
835 tracer.log(`Sending notification '${message.method}'.`, data);
\r
838 logLSPMessage('send-notification', message);
\r
841 function traceSendingResponse(message, method, startTime) {
\r
842 if (trace === Trace.Off || !tracer) {
\r
845 if (traceFormat === TraceFormat.Text) {
\r
846 let data = undefined;
\r
847 if (trace === Trace.Verbose) {
\r
848 if (message.error && message.error.data) {
\r
849 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
\r
852 if (message.result) {
\r
853 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
\r
855 else if (message.error === void 0) {
\r
856 data = 'No result returned.\n\n';
\r
860 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
\r
863 logLSPMessage('send-response', message);
\r
866 function traceReceivedRequest(message) {
\r
867 if (trace === Trace.Off || !tracer) {
\r
870 if (traceFormat === TraceFormat.Text) {
\r
871 let data = undefined;
\r
872 if (trace === Trace.Verbose && message.params) {
\r
873 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
875 tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
\r
878 logLSPMessage('receive-request', message);
\r
881 function traceReceivedNotification(message) {
\r
882 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
\r
885 if (traceFormat === TraceFormat.Text) {
\r
886 let data = undefined;
\r
887 if (trace === Trace.Verbose) {
\r
888 if (message.params) {
\r
889 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
892 data = 'No parameters provided.\n\n';
\r
895 tracer.log(`Received notification '${message.method}'.`, data);
\r
898 logLSPMessage('receive-notification', message);
\r
901 function traceReceivedResponse(message, responsePromise) {
\r
902 if (trace === Trace.Off || !tracer) {
\r
905 if (traceFormat === TraceFormat.Text) {
\r
906 let data = undefined;
\r
907 if (trace === Trace.Verbose) {
\r
908 if (message.error && message.error.data) {
\r
909 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
\r
912 if (message.result) {
\r
913 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
\r
915 else if (message.error === void 0) {
\r
916 data = 'No result returned.\n\n';
\r
920 if (responsePromise) {
\r
921 let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';
\r
922 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
\r
925 tracer.log(`Received response ${message.id} without active response promise.`, data);
\r
929 logLSPMessage('receive-response', message);
\r
932 function logLSPMessage(type, message) {
\r
933 if (!tracer || trace === Trace.Off) {
\r
936 const lspMessage = {
\r
937 isLSPMessage: true,
\r
940 timestamp: Date.now()
\r
942 tracer.log(lspMessage);
\r
944 function throwIfClosedOrDisposed() {
\r
946 throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');
\r
948 if (isDisposed()) {
\r
949 throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');
\r
952 function throwIfListening() {
\r
953 if (isListening()) {
\r
954 throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');
\r
957 function throwIfNotListening() {
\r
958 if (!isListening()) {
\r
959 throw new Error('Call listen() first.');
\r
962 function undefinedToNull(param) {
\r
963 if (param === void 0) {
\r
970 function computeMessageParams(type, params) {
\r
972 let numberOfParams = type.numberOfParams;
\r
973 switch (numberOfParams) {
\r
978 result = undefinedToNull(params[0]);
\r
982 for (let i = 0; i < params.length && i < numberOfParams; i++) {
\r
983 result.push(undefinedToNull(params[i]));
\r
985 if (params.length < numberOfParams) {
\r
986 for (let i = params.length; i < numberOfParams; i++) {
\r
995 sendNotification: (type, ...params) => {
\r
996 throwIfClosedOrDisposed();
\r
999 if (Is.string(type)) {
\r
1001 switch (params.length) {
\r
1003 messageParams = null;
\r
1006 messageParams = params[0];
\r
1009 messageParams = params;
\r
1014 method = type.method;
\r
1015 messageParams = computeMessageParams(type, params);
\r
1017 let notificationMessage = {
\r
1020 params: messageParams
\r
1022 traceSendingNotification(notificationMessage);
\r
1023 messageWriter.write(notificationMessage);
\r
1025 onNotification: (type, handler) => {
\r
1026 throwIfClosedOrDisposed();
\r
1027 if (Is.func(type)) {
\r
1028 starNotificationHandler = type;
\r
1030 else if (handler) {
\r
1031 if (Is.string(type)) {
\r
1032 notificationHandlers[type] = { type: undefined, handler };
\r
1035 notificationHandlers[type.method] = { type, handler };
\r
1039 onProgress: (_type, token, handler) => {
\r
1040 if (progressHandlers.has(token)) {
\r
1041 throw new Error(`Progress handler for token ${token} already registered`);
\r
1043 progressHandlers.set(token, handler);
\r
1046 progressHandlers.delete(token);
\r
1050 sendProgress: (_type, token, value) => {
\r
1051 connection.sendNotification(ProgressNotification.type, { token, value });
\r
1053 onUnhandledProgress: unhandledProgressEmitter.event,
\r
1054 sendRequest: (type, ...params) => {
\r
1055 throwIfClosedOrDisposed();
\r
1056 throwIfNotListening();
\r
1058 let messageParams;
\r
1059 let token = undefined;
\r
1060 if (Is.string(type)) {
\r
1062 switch (params.length) {
\r
1064 messageParams = null;
\r
1067 // The cancellation token is optional so it can also be undefined.
\r
1068 if (cancellation_1.CancellationToken.is(params[0])) {
\r
1069 messageParams = null;
\r
1070 token = params[0];
\r
1073 messageParams = undefinedToNull(params[0]);
\r
1077 const last = params.length - 1;
\r
1078 if (cancellation_1.CancellationToken.is(params[last])) {
\r
1079 token = params[last];
\r
1080 if (params.length === 2) {
\r
1081 messageParams = undefinedToNull(params[0]);
\r
1084 messageParams = params.slice(0, last).map(value => undefinedToNull(value));
\r
1088 messageParams = params.map(value => undefinedToNull(value));
\r
1094 method = type.method;
\r
1095 messageParams = computeMessageParams(type, params);
\r
1096 let numberOfParams = type.numberOfParams;
\r
1097 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;
\r
1099 let id = sequenceNumber++;
\r
1100 let result = new Promise((resolve, reject) => {
\r
1101 let requestMessage = {
\r
1105 params: messageParams
\r
1107 let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };
\r
1108 traceSendingRequest(requestMessage);
\r
1110 messageWriter.write(requestMessage);
\r
1113 // Writing the message failed. So we need to reject the promise.
\r
1114 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));
\r
1115 responsePromise = null;
\r
1117 if (responsePromise) {
\r
1118 responsePromises[String(id)] = responsePromise;
\r
1122 token.onCancellationRequested(() => {
\r
1123 connection.sendNotification(CancelNotification.type, { id });
\r
1128 onRequest: (type, handler) => {
\r
1129 throwIfClosedOrDisposed();
\r
1130 if (Is.func(type)) {
\r
1131 starRequestHandler = type;
\r
1133 else if (handler) {
\r
1134 if (Is.string(type)) {
\r
1135 requestHandlers[type] = { type: undefined, handler };
\r
1138 requestHandlers[type.method] = { type, handler };
\r
1142 trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
\r
1143 let _sendNotification = false;
\r
1144 let _traceFormat = TraceFormat.Text;
\r
1145 if (sendNotificationOrTraceOptions !== void 0) {
\r
1146 if (Is.boolean(sendNotificationOrTraceOptions)) {
\r
1147 _sendNotification = sendNotificationOrTraceOptions;
\r
1150 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
\r
1151 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
\r
1155 traceFormat = _traceFormat;
\r
1156 if (trace === Trace.Off) {
\r
1157 tracer = undefined;
\r
1162 if (_sendNotification && !isClosed() && !isDisposed()) {
\r
1163 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });
\r
1166 onError: errorEmitter.event,
\r
1167 onClose: closeEmitter.event,
\r
1168 onUnhandledNotification: unhandledNotificationEmitter.event,
\r
1169 onDispose: disposeEmitter.event,
\r
1171 if (isDisposed()) {
\r
1174 state = ConnectionState.Disposed;
\r
1175 disposeEmitter.fire(undefined);
\r
1176 let error = new Error('Connection got disposed.');
\r
1177 Object.keys(responsePromises).forEach((key) => {
\r
1178 responsePromises[key].reject(error);
\r
1180 responsePromises = Object.create(null);
\r
1181 requestTokens = Object.create(null);
\r
1182 messageQueue = new linkedMap_1.LinkedMap();
\r
1183 // Test for backwards compatibility
\r
1184 if (Is.func(messageWriter.dispose)) {
\r
1185 messageWriter.dispose();
\r
1187 if (Is.func(messageReader.dispose)) {
\r
1188 messageReader.dispose();
\r
1192 throwIfClosedOrDisposed();
\r
1193 throwIfListening();
\r
1194 state = ConnectionState.Listening;
\r
1195 messageReader.listen(callback);
\r
1198 // eslint-disable-next-line no-console
\r
1199 console.log('inspect');
\r
1202 connection.onNotification(LogTraceNotification.type, (params) => {
\r
1203 if (trace === Trace.Off || !tracer) {
\r
1206 tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);
\r
1208 connection.onNotification(ProgressNotification.type, (params) => {
\r
1209 const handler = progressHandlers.get(params.token);
\r
1211 handler(params.value);
\r
1214 unhandledProgressEmitter.fire(params);
\r
1217 return connection;
\r
1219 function isMessageReader(value) {
\r
1220 return value.listen !== void 0 && value.read === void 0;
\r
1222 function isMessageWriter(value) {
\r
1223 return value.write !== void 0 && value.end === void 0;
\r
1225 function createMessageConnection(input, output, logger, strategy) {
\r
1227 logger = exports.NullLogger;
\r
1229 let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);
\r
1230 let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);
\r
1231 return _createMessageConnection(reader, writer, logger, strategy);
\r
1233 exports.createMessageConnection = createMessageConnection;
\r
1238 /***/ ((__unused_webpack_module, exports) => {
1241 /* --------------------------------------------------------------------------------------------
\r
1242 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1243 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1244 * ------------------------------------------------------------------------------------------ */
\r
1246 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1247 function boolean(value) {
\r
1248 return value === true || value === false;
\r
1250 exports.boolean = boolean;
\r
1251 function string(value) {
\r
1252 return typeof value === 'string' || value instanceof String;
\r
1254 exports.string = string;
\r
1255 function number(value) {
\r
1256 return typeof value === 'number' || value instanceof Number;
\r
1258 exports.number = number;
\r
1259 function error(value) {
\r
1260 return value instanceof Error;
\r
1262 exports.error = error;
\r
1263 function func(value) {
\r
1264 return typeof value === 'function';
\r
1266 exports.func = func;
\r
1267 function array(value) {
\r
1268 return Array.isArray(value);
\r
1270 exports.array = array;
\r
1271 function stringArray(value) {
\r
1272 return array(value) && value.every(elem => string(elem));
\r
1274 exports.stringArray = stringArray;
\r
1279 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1282 /* --------------------------------------------------------------------------------------------
\r
1283 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1284 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1285 * ------------------------------------------------------------------------------------------ */
\r
1287 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1288 const is = __webpack_require__(6);
\r
1290 * Predefined error codes.
\r
1293 (function (ErrorCodes) {
\r
1294 // Defined by JSON RPC
\r
1295 ErrorCodes.ParseError = -32700;
\r
1296 ErrorCodes.InvalidRequest = -32600;
\r
1297 ErrorCodes.MethodNotFound = -32601;
\r
1298 ErrorCodes.InvalidParams = -32602;
\r
1299 ErrorCodes.InternalError = -32603;
\r
1300 ErrorCodes.serverErrorStart = -32099;
\r
1301 ErrorCodes.serverErrorEnd = -32000;
\r
1302 ErrorCodes.ServerNotInitialized = -32002;
\r
1303 ErrorCodes.UnknownErrorCode = -32001;
\r
1304 // Defined by the protocol.
\r
1305 ErrorCodes.RequestCancelled = -32800;
\r
1306 ErrorCodes.ContentModified = -32801;
\r
1307 // Defined by VSCode library.
\r
1308 ErrorCodes.MessageWriteError = 1;
\r
1309 ErrorCodes.MessageReadError = 2;
\r
1310 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));
\r
1312 * An error object return in a response in case a request
\r
1315 class ResponseError extends Error {
\r
1316 constructor(code, message, data) {
\r
1318 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
\r
1320 Object.setPrototypeOf(this, ResponseError.prototype);
\r
1325 message: this.message,
\r
1330 exports.ResponseError = ResponseError;
\r
1332 * An abstract implementation of a MessageType.
\r
1334 class AbstractMessageType {
\r
1335 constructor(_method, _numberOfParams) {
\r
1336 this._method = _method;
\r
1337 this._numberOfParams = _numberOfParams;
\r
1340 return this._method;
\r
1342 get numberOfParams() {
\r
1343 return this._numberOfParams;
\r
1346 exports.AbstractMessageType = AbstractMessageType;
\r
1348 * Classes to type request response pairs
\r
1350 * The type parameter RO will be removed in the next major version
\r
1351 * of the JSON RPC library since it is a LSP concept and doesn't
\r
1352 * belong here. For now it is tagged as default never.
\r
1354 class RequestType0 extends AbstractMessageType {
\r
1355 constructor(method) {
\r
1359 exports.RequestType0 = RequestType0;
\r
1360 class RequestType extends AbstractMessageType {
\r
1361 constructor(method) {
\r
1365 exports.RequestType = RequestType;
\r
1366 class RequestType1 extends AbstractMessageType {
\r
1367 constructor(method) {
\r
1371 exports.RequestType1 = RequestType1;
\r
1372 class RequestType2 extends AbstractMessageType {
\r
1373 constructor(method) {
\r
1377 exports.RequestType2 = RequestType2;
\r
1378 class RequestType3 extends AbstractMessageType {
\r
1379 constructor(method) {
\r
1383 exports.RequestType3 = RequestType3;
\r
1384 class RequestType4 extends AbstractMessageType {
\r
1385 constructor(method) {
\r
1389 exports.RequestType4 = RequestType4;
\r
1390 class RequestType5 extends AbstractMessageType {
\r
1391 constructor(method) {
\r
1395 exports.RequestType5 = RequestType5;
\r
1396 class RequestType6 extends AbstractMessageType {
\r
1397 constructor(method) {
\r
1401 exports.RequestType6 = RequestType6;
\r
1402 class RequestType7 extends AbstractMessageType {
\r
1403 constructor(method) {
\r
1407 exports.RequestType7 = RequestType7;
\r
1408 class RequestType8 extends AbstractMessageType {
\r
1409 constructor(method) {
\r
1413 exports.RequestType8 = RequestType8;
\r
1414 class RequestType9 extends AbstractMessageType {
\r
1415 constructor(method) {
\r
1419 exports.RequestType9 = RequestType9;
\r
1421 * The type parameter RO will be removed in the next major version
\r
1422 * of the JSON RPC library since it is a LSP concept and doesn't
\r
1423 * belong here. For now it is tagged as default never.
\r
1425 class NotificationType extends AbstractMessageType {
\r
1426 constructor(method) {
\r
1428 this._ = undefined;
\r
1431 exports.NotificationType = NotificationType;
\r
1432 class NotificationType0 extends AbstractMessageType {
\r
1433 constructor(method) {
\r
1437 exports.NotificationType0 = NotificationType0;
\r
1438 class NotificationType1 extends AbstractMessageType {
\r
1439 constructor(method) {
\r
1443 exports.NotificationType1 = NotificationType1;
\r
1444 class NotificationType2 extends AbstractMessageType {
\r
1445 constructor(method) {
\r
1449 exports.NotificationType2 = NotificationType2;
\r
1450 class NotificationType3 extends AbstractMessageType {
\r
1451 constructor(method) {
\r
1455 exports.NotificationType3 = NotificationType3;
\r
1456 class NotificationType4 extends AbstractMessageType {
\r
1457 constructor(method) {
\r
1461 exports.NotificationType4 = NotificationType4;
\r
1462 class NotificationType5 extends AbstractMessageType {
\r
1463 constructor(method) {
\r
1467 exports.NotificationType5 = NotificationType5;
\r
1468 class NotificationType6 extends AbstractMessageType {
\r
1469 constructor(method) {
\r
1473 exports.NotificationType6 = NotificationType6;
\r
1474 class NotificationType7 extends AbstractMessageType {
\r
1475 constructor(method) {
\r
1479 exports.NotificationType7 = NotificationType7;
\r
1480 class NotificationType8 extends AbstractMessageType {
\r
1481 constructor(method) {
\r
1485 exports.NotificationType8 = NotificationType8;
\r
1486 class NotificationType9 extends AbstractMessageType {
\r
1487 constructor(method) {
\r
1491 exports.NotificationType9 = NotificationType9;
\r
1493 * Tests if the given message is a request message
\r
1495 function isRequestMessage(message) {
\r
1496 let candidate = message;
\r
1497 return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
\r
1499 exports.isRequestMessage = isRequestMessage;
\r
1501 * Tests if the given message is a notification message
\r
1503 function isNotificationMessage(message) {
\r
1504 let candidate = message;
\r
1505 return candidate && is.string(candidate.method) && message.id === void 0;
\r
1507 exports.isNotificationMessage = isNotificationMessage;
\r
1509 * Tests if the given message is a response message
\r
1511 function isResponseMessage(message) {
\r
1512 let candidate = message;
\r
1513 return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
\r
1515 exports.isResponseMessage = isResponseMessage;
\r
1520 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1523 /* --------------------------------------------------------------------------------------------
\r
1524 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1525 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1526 * ------------------------------------------------------------------------------------------ */
\r
1528 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1529 const events_1 = __webpack_require__(9);
\r
1530 const Is = __webpack_require__(6);
\r
1531 let DefaultSize = 8192;
\r
1532 let CR = Buffer.from('\r', 'ascii')[0];
\r
1533 let LF = Buffer.from('\n', 'ascii')[0];
\r
1534 let CRLF = '\r\n';
\r
1535 class MessageBuffer {
\r
1536 constructor(encoding = 'utf8') {
\r
1537 this.encoding = encoding;
\r
1539 this.buffer = Buffer.allocUnsafe(DefaultSize);
\r
1542 var toAppend = chunk;
\r
1543 if (typeof (chunk) === 'string') {
\r
1545 var bufferLen = Buffer.byteLength(str, this.encoding);
\r
1546 toAppend = Buffer.allocUnsafe(bufferLen);
\r
1547 toAppend.write(str, 0, bufferLen, this.encoding);
\r
1549 if (this.buffer.length - this.index >= toAppend.length) {
\r
1550 toAppend.copy(this.buffer, this.index, 0, toAppend.length);
\r
1553 var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;
\r
1554 if (this.index === 0) {
\r
1555 this.buffer = Buffer.allocUnsafe(newSize);
\r
1556 toAppend.copy(this.buffer, 0, 0, toAppend.length);
\r
1559 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);
\r
1562 this.index += toAppend.length;
\r
1564 tryReadHeaders() {
\r
1565 let result = undefined;
\r
1567 while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) {
\r
1570 // No header / body separator found (e.g CRLFCRLF)
\r
1571 if (current + 3 >= this.index) {
\r
1574 result = Object.create(null);
\r
1575 let headers = this.buffer.toString('ascii', 0, current).split(CRLF);
\r
1576 headers.forEach((header) => {
\r
1577 let index = header.indexOf(':');
\r
1578 if (index === -1) {
\r
1579 throw new Error('Message header must separate key and value using :');
\r
1581 let key = header.substr(0, index);
\r
1582 let value = header.substr(index + 1).trim();
\r
1583 result[key] = value;
\r
1585 let nextStart = current + 4;
\r
1586 this.buffer = this.buffer.slice(nextStart);
\r
1587 this.index = this.index - nextStart;
\r
1590 tryReadContent(length) {
\r
1591 if (this.index < length) {
\r
1594 let result = this.buffer.toString(this.encoding, 0, length);
\r
1595 let nextStart = length;
\r
1596 this.buffer.copy(this.buffer, 0, nextStart);
\r
1597 this.index = this.index - nextStart;
\r
1600 get numberOfBytes() {
\r
1601 return this.index;
\r
1604 var MessageReader;
\r
1605 (function (MessageReader) {
\r
1606 function is(value) {
\r
1607 let candidate = value;
\r
1608 return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&
\r
1609 Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
\r
1611 MessageReader.is = is;
\r
1612 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));
\r
1613 class AbstractMessageReader {
\r
1615 this.errorEmitter = new events_1.Emitter();
\r
1616 this.closeEmitter = new events_1.Emitter();
\r
1617 this.partialMessageEmitter = new events_1.Emitter();
\r
1620 this.errorEmitter.dispose();
\r
1621 this.closeEmitter.dispose();
\r
1624 return this.errorEmitter.event;
\r
1626 fireError(error) {
\r
1627 this.errorEmitter.fire(this.asError(error));
\r
1630 return this.closeEmitter.event;
\r
1633 this.closeEmitter.fire(undefined);
\r
1635 get onPartialMessage() {
\r
1636 return this.partialMessageEmitter.event;
\r
1638 firePartialMessage(info) {
\r
1639 this.partialMessageEmitter.fire(info);
\r
1642 if (error instanceof Error) {
\r
1646 return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
\r
1650 exports.AbstractMessageReader = AbstractMessageReader;
\r
1651 class StreamMessageReader extends AbstractMessageReader {
\r
1652 constructor(readable, encoding = 'utf8') {
\r
1654 this.readable = readable;
\r
1655 this.buffer = new MessageBuffer(encoding);
\r
1656 this._partialMessageTimeout = 10000;
\r
1658 set partialMessageTimeout(timeout) {
\r
1659 this._partialMessageTimeout = timeout;
\r
1661 get partialMessageTimeout() {
\r
1662 return this._partialMessageTimeout;
\r
1664 listen(callback) {
\r
1665 this.nextMessageLength = -1;
\r
1666 this.messageToken = 0;
\r
1667 this.partialMessageTimer = undefined;
\r
1668 this.callback = callback;
\r
1669 this.readable.on('data', (data) => {
\r
1670 this.onData(data);
\r
1672 this.readable.on('error', (error) => this.fireError(error));
\r
1673 this.readable.on('close', () => this.fireClose());
\r
1676 this.buffer.append(data);
\r
1678 if (this.nextMessageLength === -1) {
\r
1679 let headers = this.buffer.tryReadHeaders();
\r
1683 let contentLength = headers['Content-Length'];
\r
1684 if (!contentLength) {
\r
1685 throw new Error('Header must provide a Content-Length property.');
\r
1687 let length = parseInt(contentLength);
\r
1688 if (isNaN(length)) {
\r
1689 throw new Error('Content-Length value must be a number.');
\r
1691 this.nextMessageLength = length;
\r
1692 // Take the encoding form the header. For compatibility
\r
1693 // treat both utf-8 and utf8 as node utf8
\r
1695 var msg = this.buffer.tryReadContent(this.nextMessageLength);
\r
1696 if (msg === null) {
\r
1697 /** We haven't received the full message yet. */
\r
1698 this.setPartialMessageTimer();
\r
1701 this.clearPartialMessageTimer();
\r
1702 this.nextMessageLength = -1;
\r
1703 this.messageToken++;
\r
1704 var json = JSON.parse(msg);
\r
1705 this.callback(json);
\r
1708 clearPartialMessageTimer() {
\r
1709 if (this.partialMessageTimer) {
\r
1710 clearTimeout(this.partialMessageTimer);
\r
1711 this.partialMessageTimer = undefined;
\r
1714 setPartialMessageTimer() {
\r
1715 this.clearPartialMessageTimer();
\r
1716 if (this._partialMessageTimeout <= 0) {
\r
1719 this.partialMessageTimer = setTimeout((token, timeout) => {
\r
1720 this.partialMessageTimer = undefined;
\r
1721 if (token === this.messageToken) {
\r
1722 this.firePartialMessage({ messageToken: token, waitingTime: timeout });
\r
1723 this.setPartialMessageTimer();
\r
1725 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
\r
1728 exports.StreamMessageReader = StreamMessageReader;
\r
1729 class IPCMessageReader extends AbstractMessageReader {
\r
1730 constructor(process) {
\r
1732 this.process = process;
\r
1733 let eventEmitter = this.process;
\r
1734 eventEmitter.on('error', (error) => this.fireError(error));
\r
1735 eventEmitter.on('close', () => this.fireClose());
\r
1737 listen(callback) {
\r
1738 this.process.on('message', callback);
\r
1741 exports.IPCMessageReader = IPCMessageReader;
\r
1742 class SocketMessageReader extends StreamMessageReader {
\r
1743 constructor(socket, encoding = 'utf-8') {
\r
1744 super(socket, encoding);
\r
1747 exports.SocketMessageReader = SocketMessageReader;
\r
1752 /***/ ((__unused_webpack_module, exports) => {
1755 /* --------------------------------------------------------------------------------------------
\r
1756 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1757 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1758 * ------------------------------------------------------------------------------------------ */
\r
1760 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1762 (function (Disposable) {
\r
1763 function create(func) {
\r
1768 Disposable.create = create;
\r
1769 })(Disposable = exports.Disposable || (exports.Disposable = {}));
\r
1771 (function (Event) {
\r
1772 const _disposable = { dispose() { } };
\r
1773 Event.None = function () { return _disposable; };
\r
1774 })(Event = exports.Event || (exports.Event = {}));
\r
1775 class CallbackList {
\r
1776 add(callback, context = null, bucket) {
\r
1777 if (!this._callbacks) {
\r
1778 this._callbacks = [];
\r
1779 this._contexts = [];
\r
1781 this._callbacks.push(callback);
\r
1782 this._contexts.push(context);
\r
1783 if (Array.isArray(bucket)) {
\r
1784 bucket.push({ dispose: () => this.remove(callback, context) });
\r
1787 remove(callback, context = null) {
\r
1788 if (!this._callbacks) {
\r
1791 var foundCallbackWithDifferentContext = false;
\r
1792 for (var i = 0, len = this._callbacks.length; i < len; i++) {
\r
1793 if (this._callbacks[i] === callback) {
\r
1794 if (this._contexts[i] === context) {
\r
1795 // callback & context match => remove it
\r
1796 this._callbacks.splice(i, 1);
\r
1797 this._contexts.splice(i, 1);
\r
1801 foundCallbackWithDifferentContext = true;
\r
1805 if (foundCallbackWithDifferentContext) {
\r
1806 throw new Error('When adding a listener with a context, you should remove it with the same context');
\r
1810 if (!this._callbacks) {
\r
1813 var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
\r
1814 for (var i = 0, len = callbacks.length; i < len; i++) {
\r
1816 ret.push(callbacks[i].apply(contexts[i], args));
\r
1819 // eslint-disable-next-line no-console
\r
1826 return !this._callbacks || this._callbacks.length === 0;
\r
1829 this._callbacks = undefined;
\r
1830 this._contexts = undefined;
\r
1834 constructor(_options) {
\r
1835 this._options = _options;
\r
1838 * For the public to allow to subscribe
\r
1839 * to events from this Emitter
\r
1842 if (!this._event) {
\r
1843 this._event = (listener, thisArgs, disposables) => {
\r
1844 if (!this._callbacks) {
\r
1845 this._callbacks = new CallbackList();
\r
1847 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
\r
1848 this._options.onFirstListenerAdd(this);
\r
1850 this._callbacks.add(listener, thisArgs);
\r
1854 this._callbacks.remove(listener, thisArgs);
\r
1855 result.dispose = Emitter._noop;
\r
1856 if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
\r
1857 this._options.onLastListenerRemove(this);
\r
1861 if (Array.isArray(disposables)) {
\r
1862 disposables.push(result);
\r
1867 return this._event;
\r
1870 * To be kept private to fire an event to
\r
1874 if (this._callbacks) {
\r
1875 this._callbacks.invoke.call(this._callbacks, event);
\r
1879 if (this._callbacks) {
\r
1880 this._callbacks.dispose();
\r
1881 this._callbacks = undefined;
\r
1885 exports.Emitter = Emitter;
\r
1886 Emitter._noop = function () { };
\r
1891 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1894 /* --------------------------------------------------------------------------------------------
\r
1895 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1896 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1897 * ------------------------------------------------------------------------------------------ */
\r
1899 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1900 const events_1 = __webpack_require__(9);
\r
1901 const Is = __webpack_require__(6);
\r
1902 let ContentLength = 'Content-Length: ';
\r
1903 let CRLF = '\r\n';
\r
1904 var MessageWriter;
\r
1905 (function (MessageWriter) {
\r
1906 function is(value) {
\r
1907 let candidate = value;
\r
1908 return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&
\r
1909 Is.func(candidate.onError) && Is.func(candidate.write);
\r
1911 MessageWriter.is = is;
\r
1912 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));
\r
1913 class AbstractMessageWriter {
\r
1915 this.errorEmitter = new events_1.Emitter();
\r
1916 this.closeEmitter = new events_1.Emitter();
\r
1919 this.errorEmitter.dispose();
\r
1920 this.closeEmitter.dispose();
\r
1923 return this.errorEmitter.event;
\r
1925 fireError(error, message, count) {
\r
1926 this.errorEmitter.fire([this.asError(error), message, count]);
\r
1929 return this.closeEmitter.event;
\r
1932 this.closeEmitter.fire(undefined);
\r
1935 if (error instanceof Error) {
\r
1939 return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
\r
1943 exports.AbstractMessageWriter = AbstractMessageWriter;
\r
1944 class StreamMessageWriter extends AbstractMessageWriter {
\r
1945 constructor(writable, encoding = 'utf8') {
\r
1947 this.writable = writable;
\r
1948 this.encoding = encoding;
\r
1949 this.errorCount = 0;
\r
1950 this.writable.on('error', (error) => this.fireError(error));
\r
1951 this.writable.on('close', () => this.fireClose());
\r
1954 let json = JSON.stringify(msg);
\r
1955 let contentLength = Buffer.byteLength(json, this.encoding);
\r
1957 ContentLength, contentLength.toString(), CRLF,
\r
1961 // Header must be written in ASCII encoding
\r
1962 this.writable.write(headers.join(''), 'ascii');
\r
1963 // Now write the content. This can be written in any encoding
\r
1964 this.writable.write(json, this.encoding);
\r
1965 this.errorCount = 0;
\r
1968 this.errorCount++;
\r
1969 this.fireError(error, msg, this.errorCount);
\r
1973 exports.StreamMessageWriter = StreamMessageWriter;
\r
1974 class IPCMessageWriter extends AbstractMessageWriter {
\r
1975 constructor(process) {
\r
1977 this.process = process;
\r
1978 this.errorCount = 0;
\r
1980 this.sending = false;
\r
1981 let eventEmitter = this.process;
\r
1982 eventEmitter.on('error', (error) => this.fireError(error));
\r
1983 eventEmitter.on('close', () => this.fireClose);
\r
1986 if (!this.sending && this.queue.length === 0) {
\r
1987 // See https://github.com/nodejs/node/issues/7657
\r
1988 this.doWriteMessage(msg);
\r
1991 this.queue.push(msg);
\r
1994 doWriteMessage(msg) {
\r
1996 if (this.process.send) {
\r
1997 this.sending = true;
\r
1998 this.process.send(msg, undefined, undefined, (error) => {
\r
1999 this.sending = false;
\r
2001 this.errorCount++;
\r
2002 this.fireError(error, msg, this.errorCount);
\r
2005 this.errorCount = 0;
\r
2007 if (this.queue.length > 0) {
\r
2008 this.doWriteMessage(this.queue.shift());
\r
2014 this.errorCount++;
\r
2015 this.fireError(error, msg, this.errorCount);
\r
2019 exports.IPCMessageWriter = IPCMessageWriter;
\r
2020 class SocketMessageWriter extends AbstractMessageWriter {
\r
2021 constructor(socket, encoding = 'utf8') {
\r
2023 this.socket = socket;
\r
2025 this.sending = false;
\r
2026 this.encoding = encoding;
\r
2027 this.errorCount = 0;
\r
2028 this.socket.on('error', (error) => this.fireError(error));
\r
2029 this.socket.on('close', () => this.fireClose());
\r
2033 this.socket.destroy();
\r
2036 if (!this.sending && this.queue.length === 0) {
\r
2037 // See https://github.com/nodejs/node/issues/7657
\r
2038 this.doWriteMessage(msg);
\r
2041 this.queue.push(msg);
\r
2044 doWriteMessage(msg) {
\r
2045 let json = JSON.stringify(msg);
\r
2046 let contentLength = Buffer.byteLength(json, this.encoding);
\r
2048 ContentLength, contentLength.toString(), CRLF,
\r
2052 // Header must be written in ASCII encoding
\r
2053 this.sending = true;
\r
2054 this.socket.write(headers.join(''), 'ascii', (error) => {
\r
2056 this.handleError(error, msg);
\r
2059 // Now write the content. This can be written in any encoding
\r
2060 this.socket.write(json, this.encoding, (error) => {
\r
2061 this.sending = false;
\r
2063 this.handleError(error, msg);
\r
2066 this.errorCount = 0;
\r
2068 if (this.queue.length > 0) {
\r
2069 this.doWriteMessage(this.queue.shift());
\r
2074 this.handleError(error, msg);
\r
2079 this.handleError(error, msg);
\r
2082 handleError(error, msg) {
\r
2083 this.errorCount++;
\r
2084 this.fireError(error, msg, this.errorCount);
\r
2087 exports.SocketMessageWriter = SocketMessageWriter;
\r
2092 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2095 /*---------------------------------------------------------------------------------------------
\r
2096 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2097 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2098 *--------------------------------------------------------------------------------------------*/
\r
2100 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2101 const events_1 = __webpack_require__(9);
\r
2102 const Is = __webpack_require__(6);
\r
2103 var CancellationToken;
\r
2104 (function (CancellationToken) {
\r
2105 CancellationToken.None = Object.freeze({
\r
2106 isCancellationRequested: false,
\r
2107 onCancellationRequested: events_1.Event.None
\r
2109 CancellationToken.Cancelled = Object.freeze({
\r
2110 isCancellationRequested: true,
\r
2111 onCancellationRequested: events_1.Event.None
\r
2113 function is(value) {
\r
2114 let candidate = value;
\r
2115 return candidate && (candidate === CancellationToken.None
\r
2116 || candidate === CancellationToken.Cancelled
\r
2117 || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));
\r
2119 CancellationToken.is = is;
\r
2120 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));
\r
2121 const shortcutEvent = Object.freeze(function (callback, context) {
\r
2122 let handle = setTimeout(callback.bind(context), 0);
\r
2123 return { dispose() { clearTimeout(handle); } };
\r
2125 class MutableToken {
\r
2127 this._isCancelled = false;
\r
2130 if (!this._isCancelled) {
\r
2131 this._isCancelled = true;
\r
2132 if (this._emitter) {
\r
2133 this._emitter.fire(undefined);
\r
2138 get isCancellationRequested() {
\r
2139 return this._isCancelled;
\r
2141 get onCancellationRequested() {
\r
2142 if (this._isCancelled) {
\r
2143 return shortcutEvent;
\r
2145 if (!this._emitter) {
\r
2146 this._emitter = new events_1.Emitter();
\r
2148 return this._emitter.event;
\r
2151 if (this._emitter) {
\r
2152 this._emitter.dispose();
\r
2153 this._emitter = undefined;
\r
2157 class CancellationTokenSource {
\r
2159 if (!this._token) {
\r
2160 // be lazy and create the token only when
\r
2161 // actually needed
\r
2162 this._token = new MutableToken();
\r
2164 return this._token;
\r
2167 if (!this._token) {
\r
2168 // save an object by returning the default
\r
2169 // cancelled token when cancellation happens
\r
2170 // before someone asks for the token
\r
2171 this._token = CancellationToken.Cancelled;
\r
2174 this._token.cancel();
\r
2178 if (!this._token) {
\r
2179 // ensure to initialize with an empty token if we had none
\r
2180 this._token = CancellationToken.None;
\r
2182 else if (this._token instanceof MutableToken) {
\r
2183 // actually dispose
\r
2184 this._token.dispose();
\r
2188 exports.CancellationTokenSource = CancellationTokenSource;
\r
2193 /***/ ((__unused_webpack_module, exports) => {
2197 /*---------------------------------------------------------------------------------------------
\r
2198 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2199 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2200 *--------------------------------------------------------------------------------------------*/
\r
2201 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2203 (function (Touch) {
\r
2207 })(Touch = exports.Touch || (exports.Touch = {}));
\r
2210 this._map = new Map();
\r
2211 this._head = undefined;
\r
2212 this._tail = undefined;
\r
2216 this._map.clear();
\r
2217 this._head = undefined;
\r
2218 this._tail = undefined;
\r
2222 return !this._head && !this._tail;
\r
2225 return this._size;
\r
2228 return this._map.has(key);
\r
2231 const item = this._map.get(key);
\r
2235 return item.value;
\r
2237 set(key, value, touch = Touch.None) {
\r
2238 let item = this._map.get(key);
\r
2240 item.value = value;
\r
2241 if (touch !== Touch.None) {
\r
2242 this.touch(item, touch);
\r
2246 item = { key, value, next: undefined, previous: undefined };
\r
2249 this.addItemLast(item);
\r
2252 this.addItemFirst(item);
\r
2255 this.addItemLast(item);
\r
2258 this.addItemLast(item);
\r
2261 this._map.set(key, item);
\r
2266 const item = this._map.get(key);
\r
2270 this._map.delete(key);
\r
2271 this.removeItem(item);
\r
2276 if (!this._head && !this._tail) {
\r
2279 if (!this._head || !this._tail) {
\r
2280 throw new Error('Invalid list');
\r
2282 const item = this._head;
\r
2283 this._map.delete(item.key);
\r
2284 this.removeItem(item);
\r
2286 return item.value;
\r
2288 forEach(callbackfn, thisArg) {
\r
2289 let current = this._head;
\r
2292 callbackfn.bind(thisArg)(current.value, current.key, this);
\r
2295 callbackfn(current.value, current.key, this);
\r
2297 current = current.next;
\r
2300 forEachReverse(callbackfn, thisArg) {
\r
2301 let current = this._tail;
\r
2304 callbackfn.bind(thisArg)(current.value, current.key, this);
\r
2307 callbackfn(current.value, current.key, this);
\r
2309 current = current.previous;
\r
2314 let current = this._head;
\r
2316 result.push(current.value);
\r
2317 current = current.next;
\r
2323 let current = this._head;
\r
2325 result.push(current.key);
\r
2326 current = current.next;
\r
2330 /* JSON RPC run on es5 which has no Symbol.iterator
\r
2331 public keys(): IterableIterator<K> {
\r
2332 let current = this._head;
\r
2333 let iterator: IterableIterator<K> = {
\r
2334 [Symbol.iterator]() {
\r
2337 next():IteratorResult<K> {
\r
2339 let result = { value: current.key, done: false };
\r
2340 current = current.next;
\r
2343 return { value: undefined, done: true };
\r
2350 public values(): IterableIterator<V> {
\r
2351 let current = this._head;
\r
2352 let iterator: IterableIterator<V> = {
\r
2353 [Symbol.iterator]() {
\r
2356 next():IteratorResult<V> {
\r
2358 let result = { value: current.value, done: false };
\r
2359 current = current.next;
\r
2362 return { value: undefined, done: true };
\r
2369 addItemFirst(item) {
\r
2370 // First time Insert
\r
2371 if (!this._head && !this._tail) {
\r
2372 this._tail = item;
\r
2374 else if (!this._head) {
\r
2375 throw new Error('Invalid list');
\r
2378 item.next = this._head;
\r
2379 this._head.previous = item;
\r
2381 this._head = item;
\r
2383 addItemLast(item) {
\r
2384 // First time Insert
\r
2385 if (!this._head && !this._tail) {
\r
2386 this._head = item;
\r
2388 else if (!this._tail) {
\r
2389 throw new Error('Invalid list');
\r
2392 item.previous = this._tail;
\r
2393 this._tail.next = item;
\r
2395 this._tail = item;
\r
2397 removeItem(item) {
\r
2398 if (item === this._head && item === this._tail) {
\r
2399 this._head = undefined;
\r
2400 this._tail = undefined;
\r
2402 else if (item === this._head) {
\r
2403 this._head = item.next;
\r
2405 else if (item === this._tail) {
\r
2406 this._tail = item.previous;
\r
2409 const next = item.next;
\r
2410 const previous = item.previous;
\r
2411 if (!next || !previous) {
\r
2412 throw new Error('Invalid list');
\r
2414 next.previous = previous;
\r
2415 previous.next = next;
\r
2418 touch(item, touch) {
\r
2419 if (!this._head || !this._tail) {
\r
2420 throw new Error('Invalid list');
\r
2422 if ((touch !== Touch.First && touch !== Touch.Last)) {
\r
2425 if (touch === Touch.First) {
\r
2426 if (item === this._head) {
\r
2429 const next = item.next;
\r
2430 const previous = item.previous;
\r
2431 // Unlink the item
\r
2432 if (item === this._tail) {
\r
2433 // previous must be defined since item was not head but is tail
\r
2434 // So there are more than on item in the map
\r
2435 previous.next = undefined;
\r
2436 this._tail = previous;
\r
2439 // Both next and previous are not undefined since item was neither head nor tail.
\r
2440 next.previous = previous;
\r
2441 previous.next = next;
\r
2443 // Insert the node at head
\r
2444 item.previous = undefined;
\r
2445 item.next = this._head;
\r
2446 this._head.previous = item;
\r
2447 this._head = item;
\r
2449 else if (touch === Touch.Last) {
\r
2450 if (item === this._tail) {
\r
2453 const next = item.next;
\r
2454 const previous = item.previous;
\r
2455 // Unlink the item.
\r
2456 if (item === this._head) {
\r
2457 // next must be defined since item was not tail but is head
\r
2458 // So there are more than on item in the map
\r
2459 next.previous = undefined;
\r
2460 this._head = next;
\r
2463 // Both next and previous are not undefined since item was neither head nor tail.
\r
2464 next.previous = previous;
\r
2465 previous.next = next;
\r
2467 item.next = undefined;
\r
2468 item.previous = this._tail;
\r
2469 this._tail.next = item;
\r
2470 this._tail = item;
\r
2474 exports.LinkedMap = LinkedMap;
\r
2479 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2482 /* --------------------------------------------------------------------------------------------
\r
2483 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2484 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2485 * ------------------------------------------------------------------------------------------ */
\r
2487 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2488 const path_1 = __webpack_require__(2);
\r
2489 const os_1 = __webpack_require__(14);
\r
2490 const crypto_1 = __webpack_require__(15);
\r
2491 const net_1 = __webpack_require__(16);
\r
2492 const messageReader_1 = __webpack_require__(8);
\r
2493 const messageWriter_1 = __webpack_require__(10);
\r
2494 function generateRandomPipeName() {
\r
2495 const randomSuffix = crypto_1.randomBytes(21).toString('hex');
\r
2496 if (process.platform === 'win32') {
\r
2497 return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
\r
2500 // Mac/Unix: use socket file
\r
2501 return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);
\r
2504 exports.generateRandomPipeName = generateRandomPipeName;
\r
2505 function createClientPipeTransport(pipeName, encoding = 'utf-8') {
\r
2506 let connectResolve;
\r
2507 let connected = new Promise((resolve, _reject) => {
\r
2508 connectResolve = resolve;
\r
2510 return new Promise((resolve, reject) => {
\r
2511 let server = net_1.createServer((socket) => {
\r
2514 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2515 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2518 server.on('error', reject);
\r
2519 server.listen(pipeName, () => {
\r
2520 server.removeListener('error', reject);
\r
2522 onConnected: () => { return connected; }
\r
2527 exports.createClientPipeTransport = createClientPipeTransport;
\r
2528 function createServerPipeTransport(pipeName, encoding = 'utf-8') {
\r
2529 const socket = net_1.createConnection(pipeName);
\r
2531 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2532 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2535 exports.createServerPipeTransport = createServerPipeTransport;
\r
2540 /***/ ((module) => {
2543 module.exports = require("os");;
2547 /***/ ((module) => {
2550 module.exports = require("crypto");;
2554 /***/ ((module) => {
2557 module.exports = require("net");;
2561 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2564 /* --------------------------------------------------------------------------------------------
\r
2565 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2566 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2567 * ------------------------------------------------------------------------------------------ */
\r
2569 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2570 const net_1 = __webpack_require__(16);
\r
2571 const messageReader_1 = __webpack_require__(8);
\r
2572 const messageWriter_1 = __webpack_require__(10);
\r
2573 function createClientSocketTransport(port, encoding = 'utf-8') {
\r
2574 let connectResolve;
\r
2575 let connected = new Promise((resolve, _reject) => {
\r
2576 connectResolve = resolve;
\r
2578 return new Promise((resolve, reject) => {
\r
2579 let server = net_1.createServer((socket) => {
\r
2582 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2583 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2586 server.on('error', reject);
\r
2587 server.listen(port, '127.0.0.1', () => {
\r
2588 server.removeListener('error', reject);
\r
2590 onConnected: () => { return connected; }
\r
2595 exports.createClientSocketTransport = createClientSocketTransport;
\r
2596 function createServerSocketTransport(port, encoding = 'utf-8') {
\r
2597 const socket = net_1.createConnection(port, '127.0.0.1');
\r
2599 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2600 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2603 exports.createServerSocketTransport = createServerSocketTransport;
\r
2608 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2611 __webpack_require__.r(__webpack_exports__);
2612 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2613 /* harmony export */ "Position": () => /* binding */ Position,
2614 /* harmony export */ "Range": () => /* binding */ Range,
2615 /* harmony export */ "Location": () => /* binding */ Location,
2616 /* harmony export */ "LocationLink": () => /* binding */ LocationLink,
2617 /* harmony export */ "Color": () => /* binding */ Color,
2618 /* harmony export */ "ColorInformation": () => /* binding */ ColorInformation,
2619 /* harmony export */ "ColorPresentation": () => /* binding */ ColorPresentation,
2620 /* harmony export */ "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
2621 /* harmony export */ "FoldingRange": () => /* binding */ FoldingRange,
2622 /* harmony export */ "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
2623 /* harmony export */ "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
2624 /* harmony export */ "DiagnosticTag": () => /* binding */ DiagnosticTag,
2625 /* harmony export */ "Diagnostic": () => /* binding */ Diagnostic,
2626 /* harmony export */ "Command": () => /* binding */ Command,
2627 /* harmony export */ "TextEdit": () => /* binding */ TextEdit,
2628 /* harmony export */ "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
2629 /* harmony export */ "CreateFile": () => /* binding */ CreateFile,
2630 /* harmony export */ "RenameFile": () => /* binding */ RenameFile,
2631 /* harmony export */ "DeleteFile": () => /* binding */ DeleteFile,
2632 /* harmony export */ "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
2633 /* harmony export */ "WorkspaceChange": () => /* binding */ WorkspaceChange,
2634 /* harmony export */ "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
2635 /* harmony export */ "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
2636 /* harmony export */ "TextDocumentItem": () => /* binding */ TextDocumentItem,
2637 /* harmony export */ "MarkupKind": () => /* binding */ MarkupKind,
2638 /* harmony export */ "MarkupContent": () => /* binding */ MarkupContent,
2639 /* harmony export */ "CompletionItemKind": () => /* binding */ CompletionItemKind,
2640 /* harmony export */ "InsertTextFormat": () => /* binding */ InsertTextFormat,
2641 /* harmony export */ "CompletionItemTag": () => /* binding */ CompletionItemTag,
2642 /* harmony export */ "CompletionItem": () => /* binding */ CompletionItem,
2643 /* harmony export */ "CompletionList": () => /* binding */ CompletionList,
2644 /* harmony export */ "MarkedString": () => /* binding */ MarkedString,
2645 /* harmony export */ "Hover": () => /* binding */ Hover,
2646 /* harmony export */ "ParameterInformation": () => /* binding */ ParameterInformation,
2647 /* harmony export */ "SignatureInformation": () => /* binding */ SignatureInformation,
2648 /* harmony export */ "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
2649 /* harmony export */ "DocumentHighlight": () => /* binding */ DocumentHighlight,
2650 /* harmony export */ "SymbolKind": () => /* binding */ SymbolKind,
2651 /* harmony export */ "SymbolTag": () => /* binding */ SymbolTag,
2652 /* harmony export */ "SymbolInformation": () => /* binding */ SymbolInformation,
2653 /* harmony export */ "DocumentSymbol": () => /* binding */ DocumentSymbol,
2654 /* harmony export */ "CodeActionKind": () => /* binding */ CodeActionKind,
2655 /* harmony export */ "CodeActionContext": () => /* binding */ CodeActionContext,
2656 /* harmony export */ "CodeAction": () => /* binding */ CodeAction,
2657 /* harmony export */ "CodeLens": () => /* binding */ CodeLens,
2658 /* harmony export */ "FormattingOptions": () => /* binding */ FormattingOptions,
2659 /* harmony export */ "DocumentLink": () => /* binding */ DocumentLink,
2660 /* harmony export */ "SelectionRange": () => /* binding */ SelectionRange,
2661 /* harmony export */ "EOL": () => /* binding */ EOL,
2662 /* harmony export */ "TextDocument": () => /* binding */ TextDocument
2663 /* harmony export */ });
2664 /* --------------------------------------------------------------------------------------------
\r
2665 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2666 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2667 * ------------------------------------------------------------------------------------------ */
\r
2670 * The Position namespace provides helper functions to work with
\r
2671 * [Position](#Position) literals.
\r
2674 (function (Position) {
\r
2676 * Creates a new Position literal from the given line and character.
\r
2677 * @param line The position's line.
\r
2678 * @param character The position's character.
\r
2680 function create(line, character) {
\r
2681 return { line: line, character: character };
\r
2683 Position.create = create;
\r
2685 * Checks whether the given liternal conforms to the [Position](#Position) interface.
\r
2687 function is(value) {
\r
2688 var candidate = value;
\r
2689 return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);
\r
2692 })(Position || (Position = {}));
\r
2694 * The Range namespace provides helper functions to work with
\r
2695 * [Range](#Range) literals.
\r
2698 (function (Range) {
\r
2699 function create(one, two, three, four) {
\r
2700 if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {
\r
2701 return { start: Position.create(one, two), end: Position.create(three, four) };
\r
2703 else if (Position.is(one) && Position.is(two)) {
\r
2704 return { start: one, end: two };
\r
2707 throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
\r
2710 Range.create = create;
\r
2712 * Checks whether the given literal conforms to the [Range](#Range) interface.
\r
2714 function is(value) {
\r
2715 var candidate = value;
\r
2716 return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
\r
2719 })(Range || (Range = {}));
\r
2721 * The Location namespace provides helper functions to work with
\r
2722 * [Location](#Location) literals.
\r
2725 (function (Location) {
\r
2727 * Creates a Location literal.
\r
2728 * @param uri The location's uri.
\r
2729 * @param range The location's range.
\r
2731 function create(uri, range) {
\r
2732 return { uri: uri, range: range };
\r
2734 Location.create = create;
\r
2736 * Checks whether the given literal conforms to the [Location](#Location) interface.
\r
2738 function is(value) {
\r
2739 var candidate = value;
\r
2740 return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
\r
2743 })(Location || (Location = {}));
\r
2745 * The LocationLink namespace provides helper functions to work with
\r
2746 * [LocationLink](#LocationLink) literals.
\r
2749 (function (LocationLink) {
\r
2751 * Creates a LocationLink literal.
\r
2752 * @param targetUri The definition's uri.
\r
2753 * @param targetRange The full range of the definition.
\r
2754 * @param targetSelectionRange The span of the symbol definition at the target.
\r
2755 * @param originSelectionRange The span of the symbol being defined in the originating source file.
\r
2757 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
\r
2758 return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
\r
2760 LocationLink.create = create;
\r
2762 * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
\r
2764 function is(value) {
\r
2765 var candidate = value;
\r
2766 return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
\r
2767 && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
\r
2768 && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
\r
2770 LocationLink.is = is;
\r
2771 })(LocationLink || (LocationLink = {}));
\r
2773 * The Color namespace provides helper functions to work with
\r
2774 * [Color](#Color) literals.
\r
2777 (function (Color) {
\r
2779 * Creates a new Color literal.
\r
2781 function create(red, green, blue, alpha) {
\r
2789 Color.create = create;
\r
2791 * Checks whether the given literal conforms to the [Color](#Color) interface.
\r
2793 function is(value) {
\r
2794 var candidate = value;
\r
2795 return Is.number(candidate.red)
\r
2796 && Is.number(candidate.green)
\r
2797 && Is.number(candidate.blue)
\r
2798 && Is.number(candidate.alpha);
\r
2801 })(Color || (Color = {}));
\r
2803 * The ColorInformation namespace provides helper functions to work with
\r
2804 * [ColorInformation](#ColorInformation) literals.
\r
2806 var ColorInformation;
\r
2807 (function (ColorInformation) {
\r
2809 * Creates a new ColorInformation literal.
\r
2811 function create(range, color) {
\r
2817 ColorInformation.create = create;
\r
2819 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
\r
2821 function is(value) {
\r
2822 var candidate = value;
\r
2823 return Range.is(candidate.range) && Color.is(candidate.color);
\r
2825 ColorInformation.is = is;
\r
2826 })(ColorInformation || (ColorInformation = {}));
\r
2828 * The Color namespace provides helper functions to work with
\r
2829 * [ColorPresentation](#ColorPresentation) literals.
\r
2831 var ColorPresentation;
\r
2832 (function (ColorPresentation) {
\r
2834 * Creates a new ColorInformation literal.
\r
2836 function create(label, textEdit, additionalTextEdits) {
\r
2839 textEdit: textEdit,
\r
2840 additionalTextEdits: additionalTextEdits,
\r
2843 ColorPresentation.create = create;
\r
2845 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
\r
2847 function is(value) {
\r
2848 var candidate = value;
\r
2849 return Is.string(candidate.label)
\r
2850 && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
\r
2851 && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
\r
2853 ColorPresentation.is = is;
\r
2854 })(ColorPresentation || (ColorPresentation = {}));
\r
2856 * Enum of known range kinds
\r
2858 var FoldingRangeKind;
\r
2859 (function (FoldingRangeKind) {
\r
2861 * Folding range for a comment
\r
2863 FoldingRangeKind["Comment"] = "comment";
\r
2865 * Folding range for a imports or includes
\r
2867 FoldingRangeKind["Imports"] = "imports";
\r
2869 * Folding range for a region (e.g. `#region`)
\r
2871 FoldingRangeKind["Region"] = "region";
\r
2872 })(FoldingRangeKind || (FoldingRangeKind = {}));
\r
2874 * The folding range namespace provides helper functions to work with
\r
2875 * [FoldingRange](#FoldingRange) literals.
\r
2878 (function (FoldingRange) {
\r
2880 * Creates a new FoldingRange literal.
\r
2882 function create(startLine, endLine, startCharacter, endCharacter, kind) {
\r
2884 startLine: startLine,
\r
2887 if (Is.defined(startCharacter)) {
\r
2888 result.startCharacter = startCharacter;
\r
2890 if (Is.defined(endCharacter)) {
\r
2891 result.endCharacter = endCharacter;
\r
2893 if (Is.defined(kind)) {
\r
2894 result.kind = kind;
\r
2898 FoldingRange.create = create;
\r
2900 * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
\r
2902 function is(value) {
\r
2903 var candidate = value;
\r
2904 return Is.number(candidate.startLine) && Is.number(candidate.startLine)
\r
2905 && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))
\r
2906 && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))
\r
2907 && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
\r
2909 FoldingRange.is = is;
\r
2910 })(FoldingRange || (FoldingRange = {}));
\r
2912 * The DiagnosticRelatedInformation namespace provides helper functions to work with
\r
2913 * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
\r
2915 var DiagnosticRelatedInformation;
\r
2916 (function (DiagnosticRelatedInformation) {
\r
2918 * Creates a new DiagnosticRelatedInformation literal.
\r
2920 function create(location, message) {
\r
2922 location: location,
\r
2926 DiagnosticRelatedInformation.create = create;
\r
2928 * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
\r
2930 function is(value) {
\r
2931 var candidate = value;
\r
2932 return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
\r
2934 DiagnosticRelatedInformation.is = is;
\r
2935 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
\r
2937 * The diagnostic's severity.
\r
2939 var DiagnosticSeverity;
\r
2940 (function (DiagnosticSeverity) {
\r
2942 * Reports an error.
\r
2944 DiagnosticSeverity.Error = 1;
\r
2946 * Reports a warning.
\r
2948 DiagnosticSeverity.Warning = 2;
\r
2950 * Reports an information.
\r
2952 DiagnosticSeverity.Information = 3;
\r
2956 DiagnosticSeverity.Hint = 4;
\r
2957 })(DiagnosticSeverity || (DiagnosticSeverity = {}));
\r
2959 * The diagnostic tags.
\r
2963 var DiagnosticTag;
\r
2964 (function (DiagnosticTag) {
\r
2966 * Unused or unnecessary code.
\r
2968 * Clients are allowed to render diagnostics with this tag faded out instead of having
\r
2969 * an error squiggle.
\r
2971 DiagnosticTag.Unnecessary = 1;
\r
2973 * Deprecated or obsolete code.
\r
2975 * Clients are allowed to rendered diagnostics with this tag strike through.
\r
2977 DiagnosticTag.Deprecated = 2;
\r
2978 })(DiagnosticTag || (DiagnosticTag = {}));
\r
2980 * The Diagnostic namespace provides helper functions to work with
\r
2981 * [Diagnostic](#Diagnostic) literals.
\r
2984 (function (Diagnostic) {
\r
2986 * Creates a new Diagnostic literal.
\r
2988 function create(range, message, severity, code, source, relatedInformation) {
\r
2989 var result = { range: range, message: message };
\r
2990 if (Is.defined(severity)) {
\r
2991 result.severity = severity;
\r
2993 if (Is.defined(code)) {
\r
2994 result.code = code;
\r
2996 if (Is.defined(source)) {
\r
2997 result.source = source;
\r
2999 if (Is.defined(relatedInformation)) {
\r
3000 result.relatedInformation = relatedInformation;
\r
3004 Diagnostic.create = create;
\r
3006 * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
\r
3008 function is(value) {
\r
3009 var candidate = value;
\r
3010 return Is.defined(candidate)
\r
3011 && Range.is(candidate.range)
\r
3012 && Is.string(candidate.message)
\r
3013 && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
\r
3014 && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
\r
3015 && (Is.string(candidate.source) || Is.undefined(candidate.source))
\r
3016 && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
\r
3018 Diagnostic.is = is;
\r
3019 })(Diagnostic || (Diagnostic = {}));
\r
3021 * The Command namespace provides helper functions to work with
\r
3022 * [Command](#Command) literals.
\r
3025 (function (Command) {
\r
3027 * Creates a new Command literal.
\r
3029 function create(title, command) {
\r
3031 for (var _i = 2; _i < arguments.length; _i++) {
\r
3032 args[_i - 2] = arguments[_i];
\r
3034 var result = { title: title, command: command };
\r
3035 if (Is.defined(args) && args.length > 0) {
\r
3036 result.arguments = args;
\r
3040 Command.create = create;
\r
3042 * Checks whether the given literal conforms to the [Command](#Command) interface.
\r
3044 function is(value) {
\r
3045 var candidate = value;
\r
3046 return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
\r
3049 })(Command || (Command = {}));
\r
3051 * The TextEdit namespace provides helper function to create replace,
\r
3052 * insert and delete edits more easily.
\r
3055 (function (TextEdit) {
\r
3057 * Creates a replace text edit.
\r
3058 * @param range The range of text to be replaced.
\r
3059 * @param newText The new text.
\r
3061 function replace(range, newText) {
\r
3062 return { range: range, newText: newText };
\r
3064 TextEdit.replace = replace;
\r
3066 * Creates a insert text edit.
\r
3067 * @param position The position to insert the text at.
\r
3068 * @param newText The text to be inserted.
\r
3070 function insert(position, newText) {
\r
3071 return { range: { start: position, end: position }, newText: newText };
\r
3073 TextEdit.insert = insert;
\r
3075 * Creates a delete text edit.
\r
3076 * @param range The range of text to be deleted.
\r
3078 function del(range) {
\r
3079 return { range: range, newText: '' };
\r
3081 TextEdit.del = del;
\r
3082 function is(value) {
\r
3083 var candidate = value;
\r
3084 return Is.objectLiteral(candidate)
\r
3085 && Is.string(candidate.newText)
\r
3086 && Range.is(candidate.range);
\r
3089 })(TextEdit || (TextEdit = {}));
\r
3091 * The TextDocumentEdit namespace provides helper function to create
\r
3092 * an edit that manipulates a text document.
\r
3094 var TextDocumentEdit;
\r
3095 (function (TextDocumentEdit) {
\r
3097 * Creates a new `TextDocumentEdit`
\r
3099 function create(textDocument, edits) {
\r
3100 return { textDocument: textDocument, edits: edits };
\r
3102 TextDocumentEdit.create = create;
\r
3103 function is(value) {
\r
3104 var candidate = value;
\r
3105 return Is.defined(candidate)
\r
3106 && VersionedTextDocumentIdentifier.is(candidate.textDocument)
\r
3107 && Array.isArray(candidate.edits);
\r
3109 TextDocumentEdit.is = is;
\r
3110 })(TextDocumentEdit || (TextDocumentEdit = {}));
\r
3112 (function (CreateFile) {
\r
3113 function create(uri, options) {
\r
3118 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
\r
3119 result.options = options;
\r
3123 CreateFile.create = create;
\r
3124 function is(value) {
\r
3125 var candidate = value;
\r
3126 return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&
\r
3127 (candidate.options === void 0 ||
\r
3128 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
\r
3130 CreateFile.is = is;
\r
3131 })(CreateFile || (CreateFile = {}));
\r
3133 (function (RenameFile) {
\r
3134 function create(oldUri, newUri, options) {
\r
3140 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
\r
3141 result.options = options;
\r
3145 RenameFile.create = create;
\r
3146 function is(value) {
\r
3147 var candidate = value;
\r
3148 return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&
\r
3149 (candidate.options === void 0 ||
\r
3150 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
\r
3152 RenameFile.is = is;
\r
3153 })(RenameFile || (RenameFile = {}));
\r
3155 (function (DeleteFile) {
\r
3156 function create(uri, options) {
\r
3161 if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
\r
3162 result.options = options;
\r
3166 DeleteFile.create = create;
\r
3167 function is(value) {
\r
3168 var candidate = value;
\r
3169 return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&
\r
3170 (candidate.options === void 0 ||
\r
3171 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));
\r
3173 DeleteFile.is = is;
\r
3174 })(DeleteFile || (DeleteFile = {}));
\r
3175 var WorkspaceEdit;
\r
3176 (function (WorkspaceEdit) {
\r
3177 function is(value) {
\r
3178 var candidate = value;
\r
3179 return candidate &&
\r
3180 (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&
\r
3181 (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {
\r
3182 if (Is.string(change.kind)) {
\r
3183 return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
\r
3186 return TextDocumentEdit.is(change);
\r
3190 WorkspaceEdit.is = is;
\r
3191 })(WorkspaceEdit || (WorkspaceEdit = {}));
\r
3192 var TextEditChangeImpl = /** @class */ (function () {
\r
3193 function TextEditChangeImpl(edits) {
\r
3194 this.edits = edits;
\r
3196 TextEditChangeImpl.prototype.insert = function (position, newText) {
\r
3197 this.edits.push(TextEdit.insert(position, newText));
\r
3199 TextEditChangeImpl.prototype.replace = function (range, newText) {
\r
3200 this.edits.push(TextEdit.replace(range, newText));
\r
3202 TextEditChangeImpl.prototype.delete = function (range) {
\r
3203 this.edits.push(TextEdit.del(range));
\r
3205 TextEditChangeImpl.prototype.add = function (edit) {
\r
3206 this.edits.push(edit);
\r
3208 TextEditChangeImpl.prototype.all = function () {
\r
3209 return this.edits;
\r
3211 TextEditChangeImpl.prototype.clear = function () {
\r
3212 this.edits.splice(0, this.edits.length);
\r
3214 return TextEditChangeImpl;
\r
3217 * A workspace change helps constructing changes to a workspace.
\r
3219 var WorkspaceChange = /** @class */ (function () {
\r
3220 function WorkspaceChange(workspaceEdit) {
\r
3222 this._textEditChanges = Object.create(null);
\r
3223 if (workspaceEdit) {
\r
3224 this._workspaceEdit = workspaceEdit;
\r
3225 if (workspaceEdit.documentChanges) {
\r
3226 workspaceEdit.documentChanges.forEach(function (change) {
\r
3227 if (TextDocumentEdit.is(change)) {
\r
3228 var textEditChange = new TextEditChangeImpl(change.edits);
\r
3229 _this._textEditChanges[change.textDocument.uri] = textEditChange;
\r
3233 else if (workspaceEdit.changes) {
\r
3234 Object.keys(workspaceEdit.changes).forEach(function (key) {
\r
3235 var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
\r
3236 _this._textEditChanges[key] = textEditChange;
\r
3241 Object.defineProperty(WorkspaceChange.prototype, "edit", {
\r
3243 * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
\r
3244 * use to be returned from a workspace edit operation like rename.
\r
3246 get: function () {
\r
3247 return this._workspaceEdit;
\r
3250 configurable: true
\r
3252 WorkspaceChange.prototype.getTextEditChange = function (key) {
\r
3253 if (VersionedTextDocumentIdentifier.is(key)) {
\r
3254 if (!this._workspaceEdit) {
\r
3255 this._workspaceEdit = {
\r
3256 documentChanges: []
\r
3259 if (!this._workspaceEdit.documentChanges) {
\r
3260 throw new Error('Workspace edit is not configured for document changes.');
\r
3262 var textDocument = key;
\r
3263 var result = this._textEditChanges[textDocument.uri];
\r
3266 var textDocumentEdit = {
\r
3267 textDocument: textDocument,
\r
3270 this._workspaceEdit.documentChanges.push(textDocumentEdit);
\r
3271 result = new TextEditChangeImpl(edits);
\r
3272 this._textEditChanges[textDocument.uri] = result;
\r
3277 if (!this._workspaceEdit) {
\r
3278 this._workspaceEdit = {
\r
3279 changes: Object.create(null)
\r
3282 if (!this._workspaceEdit.changes) {
\r
3283 throw new Error('Workspace edit is not configured for normal text edit changes.');
\r
3285 var result = this._textEditChanges[key];
\r
3288 this._workspaceEdit.changes[key] = edits;
\r
3289 result = new TextEditChangeImpl(edits);
\r
3290 this._textEditChanges[key] = result;
\r
3295 WorkspaceChange.prototype.createFile = function (uri, options) {
\r
3296 this.checkDocumentChanges();
\r
3297 this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));
\r
3299 WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {
\r
3300 this.checkDocumentChanges();
\r
3301 this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));
\r
3303 WorkspaceChange.prototype.deleteFile = function (uri, options) {
\r
3304 this.checkDocumentChanges();
\r
3305 this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));
\r
3307 WorkspaceChange.prototype.checkDocumentChanges = function () {
\r
3308 if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {
\r
3309 throw new Error('Workspace edit is not configured for document changes.');
\r
3312 return WorkspaceChange;
\r
3316 * The TextDocumentIdentifier namespace provides helper functions to work with
\r
3317 * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
\r
3319 var TextDocumentIdentifier;
\r
3320 (function (TextDocumentIdentifier) {
\r
3322 * Creates a new TextDocumentIdentifier literal.
\r
3323 * @param uri The document's uri.
\r
3325 function create(uri) {
\r
3326 return { uri: uri };
\r
3328 TextDocumentIdentifier.create = create;
\r
3330 * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
\r
3332 function is(value) {
\r
3333 var candidate = value;
\r
3334 return Is.defined(candidate) && Is.string(candidate.uri);
\r
3336 TextDocumentIdentifier.is = is;
\r
3337 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
\r
3339 * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
\r
3340 * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
\r
3342 var VersionedTextDocumentIdentifier;
\r
3343 (function (VersionedTextDocumentIdentifier) {
\r
3345 * Creates a new VersionedTextDocumentIdentifier literal.
\r
3346 * @param uri The document's uri.
\r
3347 * @param uri The document's text.
\r
3349 function create(uri, version) {
\r
3350 return { uri: uri, version: version };
\r
3352 VersionedTextDocumentIdentifier.create = create;
\r
3354 * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
\r
3356 function is(value) {
\r
3357 var candidate = value;
\r
3358 return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));
\r
3360 VersionedTextDocumentIdentifier.is = is;
\r
3361 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
\r
3363 * The TextDocumentItem namespace provides helper functions to work with
\r
3364 * [TextDocumentItem](#TextDocumentItem) literals.
\r
3366 var TextDocumentItem;
\r
3367 (function (TextDocumentItem) {
\r
3369 * Creates a new TextDocumentItem literal.
\r
3370 * @param uri The document's uri.
\r
3371 * @param languageId The document's language identifier.
\r
3372 * @param version The document's version number.
\r
3373 * @param text The document's text.
\r
3375 function create(uri, languageId, version, text) {
\r
3376 return { uri: uri, languageId: languageId, version: version, text: text };
\r
3378 TextDocumentItem.create = create;
\r
3380 * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
\r
3382 function is(value) {
\r
3383 var candidate = value;
\r
3384 return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);
\r
3386 TextDocumentItem.is = is;
\r
3387 })(TextDocumentItem || (TextDocumentItem = {}));
\r
3389 * Describes the content type that a client supports in various
\r
3390 * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
\r
3392 * Please note that `MarkupKinds` must not start with a `$`. This kinds
\r
3393 * are reserved for internal usage.
\r
3396 (function (MarkupKind) {
\r
3398 * Plain text is supported as a content format
\r
3400 MarkupKind.PlainText = 'plaintext';
\r
3402 * Markdown is supported as a content format
\r
3404 MarkupKind.Markdown = 'markdown';
\r
3405 })(MarkupKind || (MarkupKind = {}));
\r
3406 (function (MarkupKind) {
\r
3408 * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
\r
3410 function is(value) {
\r
3411 var candidate = value;
\r
3412 return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
\r
3414 MarkupKind.is = is;
\r
3415 })(MarkupKind || (MarkupKind = {}));
\r
3416 var MarkupContent;
\r
3417 (function (MarkupContent) {
\r
3419 * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
\r
3421 function is(value) {
\r
3422 var candidate = value;
\r
3423 return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
\r
3425 MarkupContent.is = is;
\r
3426 })(MarkupContent || (MarkupContent = {}));
\r
3428 * The kind of a completion entry.
\r
3430 var CompletionItemKind;
\r
3431 (function (CompletionItemKind) {
\r
3432 CompletionItemKind.Text = 1;
\r
3433 CompletionItemKind.Method = 2;
\r
3434 CompletionItemKind.Function = 3;
\r
3435 CompletionItemKind.Constructor = 4;
\r
3436 CompletionItemKind.Field = 5;
\r
3437 CompletionItemKind.Variable = 6;
\r
3438 CompletionItemKind.Class = 7;
\r
3439 CompletionItemKind.Interface = 8;
\r
3440 CompletionItemKind.Module = 9;
\r
3441 CompletionItemKind.Property = 10;
\r
3442 CompletionItemKind.Unit = 11;
\r
3443 CompletionItemKind.Value = 12;
\r
3444 CompletionItemKind.Enum = 13;
\r
3445 CompletionItemKind.Keyword = 14;
\r
3446 CompletionItemKind.Snippet = 15;
\r
3447 CompletionItemKind.Color = 16;
\r
3448 CompletionItemKind.File = 17;
\r
3449 CompletionItemKind.Reference = 18;
\r
3450 CompletionItemKind.Folder = 19;
\r
3451 CompletionItemKind.EnumMember = 20;
\r
3452 CompletionItemKind.Constant = 21;
\r
3453 CompletionItemKind.Struct = 22;
\r
3454 CompletionItemKind.Event = 23;
\r
3455 CompletionItemKind.Operator = 24;
\r
3456 CompletionItemKind.TypeParameter = 25;
\r
3457 })(CompletionItemKind || (CompletionItemKind = {}));
\r
3459 * Defines whether the insert text in a completion item should be interpreted as
\r
3460 * plain text or a snippet.
\r
3462 var InsertTextFormat;
\r
3463 (function (InsertTextFormat) {
\r
3465 * The primary text to be inserted is treated as a plain string.
\r
3467 InsertTextFormat.PlainText = 1;
\r
3469 * The primary text to be inserted is treated as a snippet.
\r
3471 * A snippet can define tab stops and placeholders with `$1`, `$2`
\r
3472 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
\r
3473 * the end of the snippet. Placeholders with equal identifiers are linked,
\r
3474 * that is typing in one will update others too.
\r
3476 * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
\r
3478 InsertTextFormat.Snippet = 2;
\r
3479 })(InsertTextFormat || (InsertTextFormat = {}));
\r
3481 * Completion item tags are extra annotations that tweak the rendering of a completion
\r
3486 var CompletionItemTag;
\r
3487 (function (CompletionItemTag) {
\r
3489 * Render a completion as obsolete, usually using a strike-out.
\r
3491 CompletionItemTag.Deprecated = 1;
\r
3492 })(CompletionItemTag || (CompletionItemTag = {}));
\r
3494 * The CompletionItem namespace provides functions to deal with
\r
3495 * completion items.
\r
3497 var CompletionItem;
\r
3498 (function (CompletionItem) {
\r
3500 * Create a completion item and seed it with a label.
\r
3501 * @param label The completion item's label
\r
3503 function create(label) {
\r
3504 return { label: label };
\r
3506 CompletionItem.create = create;
\r
3507 })(CompletionItem || (CompletionItem = {}));
\r
3509 * The CompletionList namespace provides functions to deal with
\r
3510 * completion lists.
\r
3512 var CompletionList;
\r
3513 (function (CompletionList) {
\r
3515 * Creates a new completion list.
\r
3517 * @param items The completion items.
\r
3518 * @param isIncomplete The list is not complete.
\r
3520 function create(items, isIncomplete) {
\r
3521 return { items: items ? items : [], isIncomplete: !!isIncomplete };
\r
3523 CompletionList.create = create;
\r
3524 })(CompletionList || (CompletionList = {}));
\r
3526 (function (MarkedString) {
\r
3528 * Creates a marked string from plain text.
\r
3530 * @param plainText The plain text.
\r
3532 function fromPlainText(plainText) {
\r
3533 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
\r
3535 MarkedString.fromPlainText = fromPlainText;
\r
3537 * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
\r
3539 function is(value) {
\r
3540 var candidate = value;
\r
3541 return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
\r
3543 MarkedString.is = is;
\r
3544 })(MarkedString || (MarkedString = {}));
\r
3546 (function (Hover) {
\r
3548 * Checks whether the given value conforms to the [Hover](#Hover) interface.
\r
3550 function is(value) {
\r
3551 var candidate = value;
\r
3552 return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
\r
3553 MarkedString.is(candidate.contents) ||
\r
3554 Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
\r
3557 })(Hover || (Hover = {}));
\r
3559 * The ParameterInformation namespace provides helper functions to work with
\r
3560 * [ParameterInformation](#ParameterInformation) literals.
\r
3562 var ParameterInformation;
\r
3563 (function (ParameterInformation) {
\r
3565 * Creates a new parameter information literal.
\r
3567 * @param label A label string.
\r
3568 * @param documentation A doc string.
\r
3570 function create(label, documentation) {
\r
3571 return documentation ? { label: label, documentation: documentation } : { label: label };
\r
3573 ParameterInformation.create = create;
\r
3574 })(ParameterInformation || (ParameterInformation = {}));
\r
3576 * The SignatureInformation namespace provides helper functions to work with
\r
3577 * [SignatureInformation](#SignatureInformation) literals.
\r
3579 var SignatureInformation;
\r
3580 (function (SignatureInformation) {
\r
3581 function create(label, documentation) {
\r
3582 var parameters = [];
\r
3583 for (var _i = 2; _i < arguments.length; _i++) {
\r
3584 parameters[_i - 2] = arguments[_i];
\r
3586 var result = { label: label };
\r
3587 if (Is.defined(documentation)) {
\r
3588 result.documentation = documentation;
\r
3590 if (Is.defined(parameters)) {
\r
3591 result.parameters = parameters;
\r
3594 result.parameters = [];
\r
3598 SignatureInformation.create = create;
\r
3599 })(SignatureInformation || (SignatureInformation = {}));
\r
3601 * A document highlight kind.
\r
3603 var DocumentHighlightKind;
\r
3604 (function (DocumentHighlightKind) {
\r
3606 * A textual occurrence.
\r
3608 DocumentHighlightKind.Text = 1;
\r
3610 * Read-access of a symbol, like reading a variable.
\r
3612 DocumentHighlightKind.Read = 2;
\r
3614 * Write-access of a symbol, like writing to a variable.
\r
3616 DocumentHighlightKind.Write = 3;
\r
3617 })(DocumentHighlightKind || (DocumentHighlightKind = {}));
\r
3619 * DocumentHighlight namespace to provide helper functions to work with
\r
3620 * [DocumentHighlight](#DocumentHighlight) literals.
\r
3622 var DocumentHighlight;
\r
3623 (function (DocumentHighlight) {
\r
3625 * Create a DocumentHighlight object.
\r
3626 * @param range The range the highlight applies to.
\r
3628 function create(range, kind) {
\r
3629 var result = { range: range };
\r
3630 if (Is.number(kind)) {
\r
3631 result.kind = kind;
\r
3635 DocumentHighlight.create = create;
\r
3636 })(DocumentHighlight || (DocumentHighlight = {}));
\r
3641 (function (SymbolKind) {
\r
3642 SymbolKind.File = 1;
\r
3643 SymbolKind.Module = 2;
\r
3644 SymbolKind.Namespace = 3;
\r
3645 SymbolKind.Package = 4;
\r
3646 SymbolKind.Class = 5;
\r
3647 SymbolKind.Method = 6;
\r
3648 SymbolKind.Property = 7;
\r
3649 SymbolKind.Field = 8;
\r
3650 SymbolKind.Constructor = 9;
\r
3651 SymbolKind.Enum = 10;
\r
3652 SymbolKind.Interface = 11;
\r
3653 SymbolKind.Function = 12;
\r
3654 SymbolKind.Variable = 13;
\r
3655 SymbolKind.Constant = 14;
\r
3656 SymbolKind.String = 15;
\r
3657 SymbolKind.Number = 16;
\r
3658 SymbolKind.Boolean = 17;
\r
3659 SymbolKind.Array = 18;
\r
3660 SymbolKind.Object = 19;
\r
3661 SymbolKind.Key = 20;
\r
3662 SymbolKind.Null = 21;
\r
3663 SymbolKind.EnumMember = 22;
\r
3664 SymbolKind.Struct = 23;
\r
3665 SymbolKind.Event = 24;
\r
3666 SymbolKind.Operator = 25;
\r
3667 SymbolKind.TypeParameter = 26;
\r
3668 })(SymbolKind || (SymbolKind = {}));
\r
3670 * Symbol tags are extra annotations that tweak the rendering of a symbol.
\r
3674 (function (SymbolTag) {
\r
3676 * Render a symbol as obsolete, usually using a strike-out.
\r
3678 SymbolTag.Deprecated = 1;
\r
3679 })(SymbolTag || (SymbolTag = {}));
\r
3680 var SymbolInformation;
\r
3681 (function (SymbolInformation) {
\r
3683 * Creates a new symbol information literal.
\r
3685 * @param name The name of the symbol.
\r
3686 * @param kind The kind of the symbol.
\r
3687 * @param range The range of the location of the symbol.
\r
3688 * @param uri The resource of the location of symbol, defaults to the current document.
\r
3689 * @param containerName The name of the symbol containing the symbol.
\r
3691 function create(name, kind, range, uri, containerName) {
\r
3695 location: { uri: uri, range: range }
\r
3697 if (containerName) {
\r
3698 result.containerName = containerName;
\r
3702 SymbolInformation.create = create;
\r
3703 })(SymbolInformation || (SymbolInformation = {}));
\r
3704 var DocumentSymbol;
\r
3705 (function (DocumentSymbol) {
\r
3707 * Creates a new symbol information literal.
\r
3709 * @param name The name of the symbol.
\r
3710 * @param detail The detail of the symbol.
\r
3711 * @param kind The kind of the symbol.
\r
3712 * @param range The range of the symbol.
\r
3713 * @param selectionRange The selectionRange of the symbol.
\r
3714 * @param children Children of the symbol.
\r
3716 function create(name, detail, kind, range, selectionRange, children) {
\r
3722 selectionRange: selectionRange
\r
3724 if (children !== void 0) {
\r
3725 result.children = children;
\r
3729 DocumentSymbol.create = create;
\r
3731 * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
\r
3733 function is(value) {
\r
3734 var candidate = value;
\r
3735 return candidate &&
\r
3736 Is.string(candidate.name) && Is.number(candidate.kind) &&
\r
3737 Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
\r
3738 (candidate.detail === void 0 || Is.string(candidate.detail)) &&
\r
3739 (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&
\r
3740 (candidate.children === void 0 || Array.isArray(candidate.children));
\r
3742 DocumentSymbol.is = is;
\r
3743 })(DocumentSymbol || (DocumentSymbol = {}));
\r
3745 * A set of predefined code action kinds
\r
3747 var CodeActionKind;
\r
3748 (function (CodeActionKind) {
\r
3752 CodeActionKind.Empty = '';
\r
3754 * Base kind for quickfix actions: 'quickfix'
\r
3756 CodeActionKind.QuickFix = 'quickfix';
\r
3758 * Base kind for refactoring actions: 'refactor'
\r
3760 CodeActionKind.Refactor = 'refactor';
\r
3762 * Base kind for refactoring extraction actions: 'refactor.extract'
\r
3764 * Example extract actions:
\r
3766 * - Extract method
\r
3767 * - Extract function
\r
3768 * - Extract variable
\r
3769 * - Extract interface from class
\r
3772 CodeActionKind.RefactorExtract = 'refactor.extract';
\r
3774 * Base kind for refactoring inline actions: 'refactor.inline'
\r
3776 * Example inline actions:
\r
3778 * - Inline function
\r
3779 * - Inline variable
\r
3780 * - Inline constant
\r
3783 CodeActionKind.RefactorInline = 'refactor.inline';
\r
3785 * Base kind for refactoring rewrite actions: 'refactor.rewrite'
\r
3787 * Example rewrite actions:
\r
3789 * - Convert JavaScript function to class
\r
3790 * - Add or remove parameter
\r
3791 * - Encapsulate field
\r
3792 * - Make method static
\r
3793 * - Move method to base class
\r
3796 CodeActionKind.RefactorRewrite = 'refactor.rewrite';
\r
3798 * Base kind for source actions: `source`
\r
3800 * Source code actions apply to the entire file.
\r
3802 CodeActionKind.Source = 'source';
\r
3804 * Base kind for an organize imports source action: `source.organizeImports`
\r
3806 CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
\r
3808 * Base kind for auto-fix source actions: `source.fixAll`.
\r
3810 * Fix all actions automatically fix errors that have a clear fix that do not require user input.
\r
3811 * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
\r
3815 CodeActionKind.SourceFixAll = 'source.fixAll';
\r
3816 })(CodeActionKind || (CodeActionKind = {}));
\r
3818 * The CodeActionContext namespace provides helper functions to work with
\r
3819 * [CodeActionContext](#CodeActionContext) literals.
\r
3821 var CodeActionContext;
\r
3822 (function (CodeActionContext) {
\r
3824 * Creates a new CodeActionContext literal.
\r
3826 function create(diagnostics, only) {
\r
3827 var result = { diagnostics: diagnostics };
\r
3828 if (only !== void 0 && only !== null) {
\r
3829 result.only = only;
\r
3833 CodeActionContext.create = create;
\r
3835 * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
\r
3837 function is(value) {
\r
3838 var candidate = value;
\r
3839 return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
\r
3841 CodeActionContext.is = is;
\r
3842 })(CodeActionContext || (CodeActionContext = {}));
\r
3844 (function (CodeAction) {
\r
3845 function create(title, commandOrEdit, kind) {
\r
3846 var result = { title: title };
\r
3847 if (Command.is(commandOrEdit)) {
\r
3848 result.command = commandOrEdit;
\r
3851 result.edit = commandOrEdit;
\r
3853 if (kind !== void 0) {
\r
3854 result.kind = kind;
\r
3858 CodeAction.create = create;
\r
3859 function is(value) {
\r
3860 var candidate = value;
\r
3861 return candidate && Is.string(candidate.title) &&
\r
3862 (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
\r
3863 (candidate.kind === void 0 || Is.string(candidate.kind)) &&
\r
3864 (candidate.edit !== void 0 || candidate.command !== void 0) &&
\r
3865 (candidate.command === void 0 || Command.is(candidate.command)) &&
\r
3866 (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&
\r
3867 (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
\r
3869 CodeAction.is = is;
\r
3870 })(CodeAction || (CodeAction = {}));
\r
3872 * The CodeLens namespace provides helper functions to work with
\r
3873 * [CodeLens](#CodeLens) literals.
\r
3876 (function (CodeLens) {
\r
3878 * Creates a new CodeLens literal.
\r
3880 function create(range, data) {
\r
3881 var result = { range: range };
\r
3882 if (Is.defined(data)) {
\r
3883 result.data = data;
\r
3887 CodeLens.create = create;
\r
3889 * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
\r
3891 function is(value) {
\r
3892 var candidate = value;
\r
3893 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
\r
3896 })(CodeLens || (CodeLens = {}));
\r
3898 * The FormattingOptions namespace provides helper functions to work with
\r
3899 * [FormattingOptions](#FormattingOptions) literals.
\r
3901 var FormattingOptions;
\r
3902 (function (FormattingOptions) {
\r
3904 * Creates a new FormattingOptions literal.
\r
3906 function create(tabSize, insertSpaces) {
\r
3907 return { tabSize: tabSize, insertSpaces: insertSpaces };
\r
3909 FormattingOptions.create = create;
\r
3911 * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
\r
3913 function is(value) {
\r
3914 var candidate = value;
\r
3915 return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
\r
3917 FormattingOptions.is = is;
\r
3918 })(FormattingOptions || (FormattingOptions = {}));
\r
3920 * The DocumentLink namespace provides helper functions to work with
\r
3921 * [DocumentLink](#DocumentLink) literals.
\r
3924 (function (DocumentLink) {
\r
3926 * Creates a new DocumentLink literal.
\r
3928 function create(range, target, data) {
\r
3929 return { range: range, target: target, data: data };
\r
3931 DocumentLink.create = create;
\r
3933 * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
\r
3935 function is(value) {
\r
3936 var candidate = value;
\r
3937 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
\r
3939 DocumentLink.is = is;
\r
3940 })(DocumentLink || (DocumentLink = {}));
\r
3942 * The SelectionRange namespace provides helper function to work with
\r
3943 * SelectionRange literals.
\r
3945 var SelectionRange;
\r
3946 (function (SelectionRange) {
\r
3948 * Creates a new SelectionRange
\r
3949 * @param range the range.
\r
3950 * @param parent an optional parent.
\r
3952 function create(range, parent) {
\r
3953 return { range: range, parent: parent };
\r
3955 SelectionRange.create = create;
\r
3956 function is(value) {
\r
3957 var candidate = value;
\r
3958 return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
\r
3960 SelectionRange.is = is;
\r
3961 })(SelectionRange || (SelectionRange = {}));
\r
3962 var EOL = ['\n', '\r\n', '\r'];
\r
3964 * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
\r
3967 (function (TextDocument) {
\r
3969 * Creates a new ITextDocument literal from the given uri and content.
\r
3970 * @param uri The document's uri.
\r
3971 * @param languageId The document's language Id.
\r
3972 * @param content The document's content.
\r
3974 function create(uri, languageId, version, content) {
\r
3975 return new FullTextDocument(uri, languageId, version, content);
\r
3977 TextDocument.create = create;
\r
3979 * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
\r
3981 function is(value) {
\r
3982 var candidate = value;
\r
3983 return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)
\r
3984 && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
\r
3986 TextDocument.is = is;
\r
3987 function applyEdits(document, edits) {
\r
3988 var text = document.getText();
\r
3989 var sortedEdits = mergeSort(edits, function (a, b) {
\r
3990 var diff = a.range.start.line - b.range.start.line;
\r
3992 return a.range.start.character - b.range.start.character;
\r
3996 var lastModifiedOffset = text.length;
\r
3997 for (var i = sortedEdits.length - 1; i >= 0; i--) {
\r
3998 var e = sortedEdits[i];
\r
3999 var startOffset = document.offsetAt(e.range.start);
\r
4000 var endOffset = document.offsetAt(e.range.end);
\r
4001 if (endOffset <= lastModifiedOffset) {
\r
4002 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
\r
4005 throw new Error('Overlapping edit');
\r
4007 lastModifiedOffset = startOffset;
\r
4011 TextDocument.applyEdits = applyEdits;
\r
4012 function mergeSort(data, compare) {
\r
4013 if (data.length <= 1) {
\r
4017 var p = (data.length / 2) | 0;
\r
4018 var left = data.slice(0, p);
\r
4019 var right = data.slice(p);
\r
4020 mergeSort(left, compare);
\r
4021 mergeSort(right, compare);
\r
4025 while (leftIdx < left.length && rightIdx < right.length) {
\r
4026 var ret = compare(left[leftIdx], right[rightIdx]);
\r
4028 // smaller_equal -> take left to preserve order
\r
4029 data[i++] = left[leftIdx++];
\r
4032 // greater -> take right
\r
4033 data[i++] = right[rightIdx++];
\r
4036 while (leftIdx < left.length) {
\r
4037 data[i++] = left[leftIdx++];
\r
4039 while (rightIdx < right.length) {
\r
4040 data[i++] = right[rightIdx++];
\r
4044 })(TextDocument || (TextDocument = {}));
\r
4045 var FullTextDocument = /** @class */ (function () {
\r
4046 function FullTextDocument(uri, languageId, version, content) {
\r
4048 this._languageId = languageId;
\r
4049 this._version = version;
\r
4050 this._content = content;
\r
4051 this._lineOffsets = undefined;
\r
4053 Object.defineProperty(FullTextDocument.prototype, "uri", {
\r
4054 get: function () {
\r
4058 configurable: true
\r
4060 Object.defineProperty(FullTextDocument.prototype, "languageId", {
\r
4061 get: function () {
\r
4062 return this._languageId;
\r
4065 configurable: true
\r
4067 Object.defineProperty(FullTextDocument.prototype, "version", {
\r
4068 get: function () {
\r
4069 return this._version;
\r
4072 configurable: true
\r
4074 FullTextDocument.prototype.getText = function (range) {
\r
4076 var start = this.offsetAt(range.start);
\r
4077 var end = this.offsetAt(range.end);
\r
4078 return this._content.substring(start, end);
\r
4080 return this._content;
\r
4082 FullTextDocument.prototype.update = function (event, version) {
\r
4083 this._content = event.text;
\r
4084 this._version = version;
\r
4085 this._lineOffsets = undefined;
\r
4087 FullTextDocument.prototype.getLineOffsets = function () {
\r
4088 if (this._lineOffsets === undefined) {
\r
4089 var lineOffsets = [];
\r
4090 var text = this._content;
\r
4091 var isLineStart = true;
\r
4092 for (var i = 0; i < text.length; i++) {
\r
4093 if (isLineStart) {
\r
4094 lineOffsets.push(i);
\r
4095 isLineStart = false;
\r
4097 var ch = text.charAt(i);
\r
4098 isLineStart = (ch === '\r' || ch === '\n');
\r
4099 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
\r
4103 if (isLineStart && text.length > 0) {
\r
4104 lineOffsets.push(text.length);
\r
4106 this._lineOffsets = lineOffsets;
\r
4108 return this._lineOffsets;
\r
4110 FullTextDocument.prototype.positionAt = function (offset) {
\r
4111 offset = Math.max(Math.min(offset, this._content.length), 0);
\r
4112 var lineOffsets = this.getLineOffsets();
\r
4113 var low = 0, high = lineOffsets.length;
\r
4115 return Position.create(0, offset);
\r
4117 while (low < high) {
\r
4118 var mid = Math.floor((low + high) / 2);
\r
4119 if (lineOffsets[mid] > offset) {
\r
4126 // low is the least x for which the line offset is larger than the current offset
\r
4127 // or array.length if no line offset is larger than the current offset
\r
4128 var line = low - 1;
\r
4129 return Position.create(line, offset - lineOffsets[line]);
\r
4131 FullTextDocument.prototype.offsetAt = function (position) {
\r
4132 var lineOffsets = this.getLineOffsets();
\r
4133 if (position.line >= lineOffsets.length) {
\r
4134 return this._content.length;
\r
4136 else if (position.line < 0) {
\r
4139 var lineOffset = lineOffsets[position.line];
\r
4140 var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
\r
4141 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
\r
4143 Object.defineProperty(FullTextDocument.prototype, "lineCount", {
\r
4144 get: function () {
\r
4145 return this.getLineOffsets().length;
\r
4148 configurable: true
\r
4150 return FullTextDocument;
\r
4154 var toString = Object.prototype.toString;
\r
4155 function defined(value) {
\r
4156 return typeof value !== 'undefined';
\r
4158 Is.defined = defined;
\r
4159 function undefined(value) {
\r
4160 return typeof value === 'undefined';
\r
4162 Is.undefined = undefined;
\r
4163 function boolean(value) {
\r
4164 return value === true || value === false;
\r
4166 Is.boolean = boolean;
\r
4167 function string(value) {
\r
4168 return toString.call(value) === '[object String]';
\r
4170 Is.string = string;
\r
4171 function number(value) {
\r
4172 return toString.call(value) === '[object Number]';
\r
4174 Is.number = number;
\r
4175 function func(value) {
\r
4176 return toString.call(value) === '[object Function]';
\r
4179 function objectLiteral(value) {
\r
4180 // Strictly speaking class instances pass this check as well. Since the LSP
\r
4181 // doesn't use classes we ignore this for now. If we do we need to add something
\r
4182 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
\r
4183 return value !== null && typeof value === 'object';
\r
4185 Is.objectLiteral = objectLiteral;
\r
4186 function typedArray(value, check) {
\r
4187 return Array.isArray(value) && value.every(check);
\r
4189 Is.typedArray = typedArray;
\r
4190 })(Is || (Is = {}));
\r
4195 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4198 /* --------------------------------------------------------------------------------------------
\r
4199 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4200 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4201 * ------------------------------------------------------------------------------------------ */
\r
4203 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4204 const Is = __webpack_require__(20);
\r
4205 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
4206 const messages_1 = __webpack_require__(21);
\r
4207 const protocol_implementation_1 = __webpack_require__(22);
\r
4208 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;
\r
4209 const protocol_typeDefinition_1 = __webpack_require__(23);
\r
4210 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;
\r
4211 const protocol_workspaceFolders_1 = __webpack_require__(24);
\r
4212 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;
\r
4213 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;
\r
4214 const protocol_configuration_1 = __webpack_require__(25);
\r
4215 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;
\r
4216 const protocol_colorProvider_1 = __webpack_require__(26);
\r
4217 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;
\r
4218 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;
\r
4219 const protocol_foldingRange_1 = __webpack_require__(27);
\r
4220 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;
\r
4221 const protocol_declaration_1 = __webpack_require__(28);
\r
4222 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;
\r
4223 const protocol_selectionRange_1 = __webpack_require__(29);
\r
4224 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;
\r
4225 const protocol_progress_1 = __webpack_require__(30);
\r
4226 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;
\r
4227 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;
\r
4228 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;
\r
4229 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
4230 let __noDynamicImport;
\r
4232 * The DocumentFilter namespace provides helper functions to work with
\r
4233 * [DocumentFilter](#DocumentFilter) literals.
\r
4235 var DocumentFilter;
\r
4236 (function (DocumentFilter) {
\r
4237 function is(value) {
\r
4238 const candidate = value;
\r
4239 return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);
\r
4241 DocumentFilter.is = is;
\r
4242 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));
\r
4244 * The DocumentSelector namespace provides helper functions to work with
\r
4245 * [DocumentSelector](#DocumentSelector)s.
\r
4247 var DocumentSelector;
\r
4248 (function (DocumentSelector) {
\r
4249 function is(value) {
\r
4250 if (!Array.isArray(value)) {
\r
4253 for (let elem of value) {
\r
4254 if (!Is.string(elem) && !DocumentFilter.is(elem)) {
\r
4260 DocumentSelector.is = is;
\r
4261 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));
\r
4263 * The `client/registerCapability` request is sent from the server to the client to register a new capability
\r
4264 * handler on the client side.
\r
4266 var RegistrationRequest;
\r
4267 (function (RegistrationRequest) {
\r
4268 RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');
\r
4269 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));
\r
4271 * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability
\r
4272 * handler on the client side.
\r
4274 var UnregistrationRequest;
\r
4275 (function (UnregistrationRequest) {
\r
4276 UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');
\r
4277 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));
\r
4278 var ResourceOperationKind;
\r
4279 (function (ResourceOperationKind) {
\r
4281 * Supports creating new files and folders.
\r
4283 ResourceOperationKind.Create = 'create';
\r
4285 * Supports renaming existing files and folders.
\r
4287 ResourceOperationKind.Rename = 'rename';
\r
4289 * Supports deleting existing files and folders.
\r
4291 ResourceOperationKind.Delete = 'delete';
\r
4292 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));
\r
4293 var FailureHandlingKind;
\r
4294 (function (FailureHandlingKind) {
\r
4296 * Applying the workspace change is simply aborted if one of the changes provided
\r
4297 * fails. All operations executed before the failing operation stay executed.
\r
4299 FailureHandlingKind.Abort = 'abort';
\r
4301 * All operations are executed transactional. That means they either all
\r
4302 * succeed or no changes at all are applied to the workspace.
\r
4304 FailureHandlingKind.Transactional = 'transactional';
\r
4306 * If the workspace edit contains only textual file changes they are executed transactional.
\r
4307 * If resource changes (create, rename or delete file) are part of the change the failure
\r
4308 * handling startegy is abort.
\r
4310 FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';
\r
4312 * The client tries to undo the operations already executed. But there is no
\r
4313 * guarantee that this is succeeding.
\r
4315 FailureHandlingKind.Undo = 'undo';
\r
4316 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));
\r
4318 * The StaticRegistrationOptions namespace provides helper functions to work with
\r
4319 * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.
\r
4321 var StaticRegistrationOptions;
\r
4322 (function (StaticRegistrationOptions) {
\r
4323 function hasId(value) {
\r
4324 const candidate = value;
\r
4325 return candidate && Is.string(candidate.id) && candidate.id.length > 0;
\r
4327 StaticRegistrationOptions.hasId = hasId;
\r
4328 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));
\r
4330 * The TextDocumentRegistrationOptions namespace provides helper functions to work with
\r
4331 * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.
\r
4333 var TextDocumentRegistrationOptions;
\r
4334 (function (TextDocumentRegistrationOptions) {
\r
4335 function is(value) {
\r
4336 const candidate = value;
\r
4337 return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
\r
4339 TextDocumentRegistrationOptions.is = is;
\r
4340 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));
\r
4342 * The WorkDoneProgressOptions namespace provides helper functions to work with
\r
4343 * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.
\r
4345 var WorkDoneProgressOptions;
\r
4346 (function (WorkDoneProgressOptions) {
\r
4347 function is(value) {
\r
4348 const candidate = value;
\r
4349 return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));
\r
4351 WorkDoneProgressOptions.is = is;
\r
4352 function hasWorkDoneProgress(value) {
\r
4353 const candidate = value;
\r
4354 return candidate && Is.boolean(candidate.workDoneProgress);
\r
4356 WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;
\r
4357 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));
\r
4359 * The initialize request is sent from the client to the server.
\r
4360 * It is sent once as the request after starting up the server.
\r
4361 * The requests parameter is of type [InitializeParams](#InitializeParams)
\r
4362 * the response if of type [InitializeResult](#InitializeResult) of a Thenable that
\r
4363 * resolves to such.
\r
4365 var InitializeRequest;
\r
4366 (function (InitializeRequest) {
\r
4367 InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');
\r
4368 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));
\r
4370 * Known error codes for an `InitializeError`;
\r
4372 var InitializeError;
\r
4373 (function (InitializeError) {
\r
4375 * If the protocol version provided by the client can't be handled by the server.
\r
4376 * @deprecated This initialize error got replaced by client capabilities. There is
\r
4377 * no version handshake in version 3.0x
\r
4379 InitializeError.unknownProtocolVersion = 1;
\r
4380 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));
\r
4382 * The intialized notification is sent from the client to the
\r
4383 * server after the client is fully initialized and the server
\r
4384 * is allowed to send requests from the server to the client.
\r
4386 var InitializedNotification;
\r
4387 (function (InitializedNotification) {
\r
4388 InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');
\r
4389 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));
\r
4390 //---- Shutdown Method ----
\r
4392 * A shutdown request is sent from the client to the server.
\r
4393 * It is sent once when the client decides to shutdown the
\r
4394 * server. The only notification that is sent after a shutdown request
\r
4395 * is the exit event.
\r
4397 var ShutdownRequest;
\r
4398 (function (ShutdownRequest) {
\r
4399 ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');
\r
4400 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));
\r
4401 //---- Exit Notification ----
\r
4403 * The exit event is sent from the client to the server to
\r
4404 * ask the server to exit its process.
\r
4406 var ExitNotification;
\r
4407 (function (ExitNotification) {
\r
4408 ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');
\r
4409 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));
\r
4411 * The configuration change notification is sent from the client to the server
\r
4412 * when the client's configuration has changed. The notification contains
\r
4413 * the changed configuration as defined by the language client.
\r
4415 var DidChangeConfigurationNotification;
\r
4416 (function (DidChangeConfigurationNotification) {
\r
4417 DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');
\r
4418 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));
\r
4419 //---- Message show and log notifications ----
\r
4421 * The message type
\r
4424 (function (MessageType) {
\r
4426 * An error message.
\r
4428 MessageType.Error = 1;
\r
4430 * A warning message.
\r
4432 MessageType.Warning = 2;
\r
4434 * An information message.
\r
4436 MessageType.Info = 3;
\r
4440 MessageType.Log = 4;
\r
4441 })(MessageType = exports.MessageType || (exports.MessageType = {}));
\r
4443 * The show message notification is sent from a server to a client to ask
\r
4444 * the client to display a particular message in the user interface.
\r
4446 var ShowMessageNotification;
\r
4447 (function (ShowMessageNotification) {
\r
4448 ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');
\r
4449 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));
\r
4451 * The show message request is sent from the server to the client to show a message
\r
4452 * and a set of options actions to the user.
\r
4454 var ShowMessageRequest;
\r
4455 (function (ShowMessageRequest) {
\r
4456 ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');
\r
4457 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));
\r
4459 * The log message notification is sent from the server to the client to ask
\r
4460 * the client to log a particular message.
\r
4462 var LogMessageNotification;
\r
4463 (function (LogMessageNotification) {
\r
4464 LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');
\r
4465 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));
\r
4466 //---- Telemetry notification
\r
4468 * The telemetry event notification is sent from the server to the client to ask
\r
4469 * the client to log telemetry data.
\r
4471 var TelemetryEventNotification;
\r
4472 (function (TelemetryEventNotification) {
\r
4473 TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');
\r
4474 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));
\r
4476 * Defines how the host (editor) should sync
\r
4477 * document changes to the language server.
\r
4479 var TextDocumentSyncKind;
\r
4480 (function (TextDocumentSyncKind) {
\r
4482 * Documents should not be synced at all.
\r
4484 TextDocumentSyncKind.None = 0;
\r
4486 * Documents are synced by always sending the full content
\r
4487 * of the document.
\r
4489 TextDocumentSyncKind.Full = 1;
\r
4491 * Documents are synced by sending the full content on open.
\r
4492 * After that only incremental updates to the document are
\r
4495 TextDocumentSyncKind.Incremental = 2;
\r
4496 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));
\r
4498 * The document open notification is sent from the client to the server to signal
\r
4499 * newly opened text documents. The document's truth is now managed by the client
\r
4500 * and the server must not try to read the document's truth using the document's
\r
4501 * uri. Open in this sense means it is managed by the client. It doesn't necessarily
\r
4502 * mean that its content is presented in an editor. An open notification must not
\r
4503 * be sent more than once without a corresponding close notification send before.
\r
4504 * This means open and close notification must be balanced and the max open count
\r
4507 var DidOpenTextDocumentNotification;
\r
4508 (function (DidOpenTextDocumentNotification) {
\r
4509 DidOpenTextDocumentNotification.method = 'textDocument/didOpen';
\r
4510 DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);
\r
4511 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));
\r
4513 * The document change notification is sent from the client to the server to signal
\r
4514 * changes to a text document.
\r
4516 var DidChangeTextDocumentNotification;
\r
4517 (function (DidChangeTextDocumentNotification) {
\r
4518 DidChangeTextDocumentNotification.method = 'textDocument/didChange';
\r
4519 DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);
\r
4520 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));
\r
4522 * The document close notification is sent from the client to the server when
\r
4523 * the document got closed in the client. The document's truth now exists where
\r
4524 * the document's uri points to (e.g. if the document's uri is a file uri the
\r
4525 * truth now exists on disk). As with the open notification the close notification
\r
4526 * is about managing the document's content. Receiving a close notification
\r
4527 * doesn't mean that the document was open in an editor before. A close
\r
4528 * notification requires a previous open notification to be sent.
\r
4530 var DidCloseTextDocumentNotification;
\r
4531 (function (DidCloseTextDocumentNotification) {
\r
4532 DidCloseTextDocumentNotification.method = 'textDocument/didClose';
\r
4533 DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);
\r
4534 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));
\r
4536 * The document save notification is sent from the client to the server when
\r
4537 * the document got saved in the client.
\r
4539 var DidSaveTextDocumentNotification;
\r
4540 (function (DidSaveTextDocumentNotification) {
\r
4541 DidSaveTextDocumentNotification.method = 'textDocument/didSave';
\r
4542 DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);
\r
4543 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));
\r
4545 * Represents reasons why a text document is saved.
\r
4547 var TextDocumentSaveReason;
\r
4548 (function (TextDocumentSaveReason) {
\r
4550 * Manually triggered, e.g. by the user pressing save, by starting debugging,
\r
4551 * or by an API call.
\r
4553 TextDocumentSaveReason.Manual = 1;
\r
4555 * Automatic after a delay.
\r
4557 TextDocumentSaveReason.AfterDelay = 2;
\r
4559 * When the editor lost focus.
\r
4561 TextDocumentSaveReason.FocusOut = 3;
\r
4562 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));
\r
4564 * A document will save notification is sent from the client to the server before
\r
4565 * the document is actually saved.
\r
4567 var WillSaveTextDocumentNotification;
\r
4568 (function (WillSaveTextDocumentNotification) {
\r
4569 WillSaveTextDocumentNotification.method = 'textDocument/willSave';
\r
4570 WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);
\r
4571 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));
\r
4573 * A document will save request is sent from the client to the server before
\r
4574 * the document is actually saved. The request can return an array of TextEdits
\r
4575 * which will be applied to the text document before it is saved. Please note that
\r
4576 * clients might drop results if computing the text edits took too long or if a
\r
4577 * server constantly fails on this request. This is done to keep the save fast and
\r
4580 var WillSaveTextDocumentWaitUntilRequest;
\r
4581 (function (WillSaveTextDocumentWaitUntilRequest) {
\r
4582 WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';
\r
4583 WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);
\r
4584 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));
\r
4586 * The watched files notification is sent from the client to the server when
\r
4587 * the client detects changes to file watched by the language client.
\r
4589 var DidChangeWatchedFilesNotification;
\r
4590 (function (DidChangeWatchedFilesNotification) {
\r
4591 DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');
\r
4592 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));
\r
4594 * The file event type
\r
4596 var FileChangeType;
\r
4597 (function (FileChangeType) {
\r
4599 * The file got created.
\r
4601 FileChangeType.Created = 1;
\r
4603 * The file got changed.
\r
4605 FileChangeType.Changed = 2;
\r
4607 * The file got deleted.
\r
4609 FileChangeType.Deleted = 3;
\r
4610 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));
\r
4612 (function (WatchKind) {
\r
4614 * Interested in create events.
\r
4616 WatchKind.Create = 1;
\r
4618 * Interested in change events
\r
4620 WatchKind.Change = 2;
\r
4622 * Interested in delete events
\r
4624 WatchKind.Delete = 4;
\r
4625 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));
\r
4627 * Diagnostics notification are sent from the server to the client to signal
\r
4628 * results of validation runs.
\r
4630 var PublishDiagnosticsNotification;
\r
4631 (function (PublishDiagnosticsNotification) {
\r
4632 PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');
\r
4633 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));
\r
4635 * How a completion was triggered
\r
4637 var CompletionTriggerKind;
\r
4638 (function (CompletionTriggerKind) {
\r
4640 * Completion was triggered by typing an identifier (24x7 code
\r
4641 * complete), manual invocation (e.g Ctrl+Space) or via API.
\r
4643 CompletionTriggerKind.Invoked = 1;
\r
4645 * Completion was triggered by a trigger character specified by
\r
4646 * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
\r
4648 CompletionTriggerKind.TriggerCharacter = 2;
\r
4650 * Completion was re-triggered as current completion list is incomplete
\r
4652 CompletionTriggerKind.TriggerForIncompleteCompletions = 3;
\r
4653 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));
\r
4655 * Request to request completion at a given text document position. The request's
\r
4656 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response
\r
4657 * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)
\r
4658 * or a Thenable that resolves to such.
\r
4660 * The request can delay the computation of the [`detail`](#CompletionItem.detail)
\r
4661 * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`
\r
4662 * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,
\r
4663 * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
\r
4665 var CompletionRequest;
\r
4666 (function (CompletionRequest) {
\r
4667 CompletionRequest.method = 'textDocument/completion';
\r
4668 CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);
\r
4669 /** @deprecated Use CompletionRequest.type */
\r
4670 CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4671 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));
\r
4673 * Request to resolve additional information for a given completion item.The request's
\r
4674 * parameter is of type [CompletionItem](#CompletionItem) the response
\r
4675 * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.
\r
4677 var CompletionResolveRequest;
\r
4678 (function (CompletionResolveRequest) {
\r
4679 CompletionResolveRequest.method = 'completionItem/resolve';
\r
4680 CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);
\r
4681 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));
\r
4683 * Request to request hover information at a given text document position. The request's
\r
4684 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of
\r
4685 * type [Hover](#Hover) or a Thenable that resolves to such.
\r
4688 (function (HoverRequest) {
\r
4689 HoverRequest.method = 'textDocument/hover';
\r
4690 HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);
\r
4691 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));
\r
4693 * How a signature help was triggered.
\r
4697 var SignatureHelpTriggerKind;
\r
4698 (function (SignatureHelpTriggerKind) {
\r
4700 * Signature help was invoked manually by the user or by a command.
\r
4702 SignatureHelpTriggerKind.Invoked = 1;
\r
4704 * Signature help was triggered by a trigger character.
\r
4706 SignatureHelpTriggerKind.TriggerCharacter = 2;
\r
4708 * Signature help was triggered by the cursor moving or by the document content changing.
\r
4710 SignatureHelpTriggerKind.ContentChange = 3;
\r
4711 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));
\r
4712 var SignatureHelpRequest;
\r
4713 (function (SignatureHelpRequest) {
\r
4714 SignatureHelpRequest.method = 'textDocument/signatureHelp';
\r
4715 SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);
\r
4716 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));
\r
4718 * A request to resolve the definition location of a symbol at a given text
\r
4719 * document position. The request's parameter is of type [TextDocumentPosition]
\r
4720 * (#TextDocumentPosition) the response is of either type [Definition](#Definition)
\r
4721 * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves
\r
4724 var DefinitionRequest;
\r
4725 (function (DefinitionRequest) {
\r
4726 DefinitionRequest.method = 'textDocument/definition';
\r
4727 DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);
\r
4728 /** @deprecated Use DefinitionRequest.type */
\r
4729 DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4730 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));
\r
4732 * A request to resolve project-wide references for the symbol denoted
\r
4733 * by the given text document position. The request's parameter is of
\r
4734 * type [ReferenceParams](#ReferenceParams) the response is of type
\r
4735 * [Location[]](#Location) or a Thenable that resolves to such.
\r
4737 var ReferencesRequest;
\r
4738 (function (ReferencesRequest) {
\r
4739 ReferencesRequest.method = 'textDocument/references';
\r
4740 ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);
\r
4741 /** @deprecated Use ReferencesRequest.type */
\r
4742 ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4743 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));
\r
4745 * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given
\r
4746 * text document position. The request's parameter is of type [TextDocumentPosition]
\r
4747 * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]
\r
4748 * (#DocumentHighlight) or a Thenable that resolves to such.
\r
4750 var DocumentHighlightRequest;
\r
4751 (function (DocumentHighlightRequest) {
\r
4752 DocumentHighlightRequest.method = 'textDocument/documentHighlight';
\r
4753 DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);
\r
4754 /** @deprecated Use DocumentHighlightRequest.type */
\r
4755 DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4756 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));
\r
4758 * A request to list all symbols found in a given text document. The request's
\r
4759 * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the
\r
4760 * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable
\r
4761 * that resolves to such.
\r
4763 var DocumentSymbolRequest;
\r
4764 (function (DocumentSymbolRequest) {
\r
4765 DocumentSymbolRequest.method = 'textDocument/documentSymbol';
\r
4766 DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);
\r
4767 /** @deprecated Use DocumentSymbolRequest.type */
\r
4768 DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4769 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));
\r
4771 * A request to provide commands for the given text document and range.
\r
4773 var CodeActionRequest;
\r
4774 (function (CodeActionRequest) {
\r
4775 CodeActionRequest.method = 'textDocument/codeAction';
\r
4776 CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);
\r
4777 /** @deprecated Use CodeActionRequest.type */
\r
4778 CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4779 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));
\r
4781 * A request to list project-wide symbols matching the query string given
\r
4782 * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is
\r
4783 * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that
\r
4784 * resolves to such.
\r
4786 var WorkspaceSymbolRequest;
\r
4787 (function (WorkspaceSymbolRequest) {
\r
4788 WorkspaceSymbolRequest.method = 'workspace/symbol';
\r
4789 WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);
\r
4790 /** @deprecated Use WorkspaceSymbolRequest.type */
\r
4791 WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4792 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));
\r
4794 * A request to provide code lens for the given text document.
\r
4796 var CodeLensRequest;
\r
4797 (function (CodeLensRequest) {
\r
4798 CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');
\r
4799 /** @deprecated Use CodeLensRequest.type */
\r
4800 CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4801 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));
\r
4803 * A request to resolve a command for a given code lens.
\r
4805 var CodeLensResolveRequest;
\r
4806 (function (CodeLensResolveRequest) {
\r
4807 CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');
\r
4808 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));
\r
4810 * A request to provide document links
\r
4812 var DocumentLinkRequest;
\r
4813 (function (DocumentLinkRequest) {
\r
4814 DocumentLinkRequest.method = 'textDocument/documentLink';
\r
4815 DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);
\r
4816 /** @deprecated Use DocumentLinkRequest.type */
\r
4817 DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4818 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));
\r
4820 * Request to resolve additional information for a given document link. The request's
\r
4821 * parameter is of type [DocumentLink](#DocumentLink) the response
\r
4822 * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.
\r
4824 var DocumentLinkResolveRequest;
\r
4825 (function (DocumentLinkResolveRequest) {
\r
4826 DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');
\r
4827 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));
\r
4829 * A request to to format a whole document.
\r
4831 var DocumentFormattingRequest;
\r
4832 (function (DocumentFormattingRequest) {
\r
4833 DocumentFormattingRequest.method = 'textDocument/formatting';
\r
4834 DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);
\r
4835 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));
\r
4837 * A request to to format a range in a document.
\r
4839 var DocumentRangeFormattingRequest;
\r
4840 (function (DocumentRangeFormattingRequest) {
\r
4841 DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';
\r
4842 DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);
\r
4843 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));
\r
4845 * A request to format a document on type.
\r
4847 var DocumentOnTypeFormattingRequest;
\r
4848 (function (DocumentOnTypeFormattingRequest) {
\r
4849 DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';
\r
4850 DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);
\r
4851 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));
\r
4853 * A request to rename a symbol.
\r
4855 var RenameRequest;
\r
4856 (function (RenameRequest) {
\r
4857 RenameRequest.method = 'textDocument/rename';
\r
4858 RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);
\r
4859 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));
\r
4861 * A request to test and perform the setup necessary for a rename.
\r
4863 var PrepareRenameRequest;
\r
4864 (function (PrepareRenameRequest) {
\r
4865 PrepareRenameRequest.method = 'textDocument/prepareRename';
\r
4866 PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);
\r
4867 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));
\r
4869 * A request send from the client to the server to execute a command. The request might return
\r
4870 * a workspace edit which the client will apply to the workspace.
\r
4872 var ExecuteCommandRequest;
\r
4873 (function (ExecuteCommandRequest) {
\r
4874 ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');
\r
4875 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));
\r
4877 * A request sent from the server to the client to modified certain resources.
\r
4879 var ApplyWorkspaceEditRequest;
\r
4880 (function (ApplyWorkspaceEditRequest) {
\r
4881 ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');
\r
4882 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));
\r
4887 /***/ ((__unused_webpack_module, exports) => {
4890 /* --------------------------------------------------------------------------------------------
\r
4891 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4892 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4893 * ------------------------------------------------------------------------------------------ */
\r
4895 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4896 function boolean(value) {
\r
4897 return value === true || value === false;
\r
4899 exports.boolean = boolean;
\r
4900 function string(value) {
\r
4901 return typeof value === 'string' || value instanceof String;
\r
4903 exports.string = string;
\r
4904 function number(value) {
\r
4905 return typeof value === 'number' || value instanceof Number;
\r
4907 exports.number = number;
\r
4908 function error(value) {
\r
4909 return value instanceof Error;
\r
4911 exports.error = error;
\r
4912 function func(value) {
\r
4913 return typeof value === 'function';
\r
4915 exports.func = func;
\r
4916 function array(value) {
\r
4917 return Array.isArray(value);
\r
4919 exports.array = array;
\r
4920 function stringArray(value) {
\r
4921 return array(value) && value.every(elem => string(elem));
\r
4923 exports.stringArray = stringArray;
\r
4924 function typedArray(value, check) {
\r
4925 return Array.isArray(value) && value.every(check);
\r
4927 exports.typedArray = typedArray;
\r
4928 function objectLiteral(value) {
\r
4929 // Strictly speaking class instances pass this check as well. Since the LSP
\r
4930 // doesn't use classes we ignore this for now. If we do we need to add something
\r
4931 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
\r
4932 return value !== null && typeof value === 'object';
\r
4934 exports.objectLiteral = objectLiteral;
\r
4939 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4942 /* --------------------------------------------------------------------------------------------
\r
4943 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4944 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4945 * ------------------------------------------------------------------------------------------ */
\r
4947 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4948 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
4949 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {
\r
4950 constructor(method) {
\r
4954 exports.ProtocolRequestType0 = ProtocolRequestType0;
\r
4955 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {
\r
4956 constructor(method) {
\r
4960 exports.ProtocolRequestType = ProtocolRequestType;
\r
4961 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {
\r
4962 constructor(method) {
\r
4966 exports.ProtocolNotificationType = ProtocolNotificationType;
\r
4967 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {
\r
4968 constructor(method) {
\r
4972 exports.ProtocolNotificationType0 = ProtocolNotificationType0;
\r
4977 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4980 /* --------------------------------------------------------------------------------------------
\r
4981 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4982 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4983 * ------------------------------------------------------------------------------------------ */
\r
4985 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4986 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
4987 const messages_1 = __webpack_require__(21);
\r
4988 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
4989 let __noDynamicImport;
\r
4991 * A request to resolve the implementation locations of a symbol at a given text
\r
4992 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
4993 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
\r
4994 * Thenable that resolves to such.
\r
4996 var ImplementationRequest;
\r
4997 (function (ImplementationRequest) {
\r
4998 ImplementationRequest.method = 'textDocument/implementation';
\r
4999 ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);
\r
5000 /** @deprecated Use ImplementationRequest.type */
\r
5001 ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5002 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));
\r
5007 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5010 /* --------------------------------------------------------------------------------------------
\r
5011 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5012 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5013 * ------------------------------------------------------------------------------------------ */
\r
5015 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5016 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5017 const messages_1 = __webpack_require__(21);
\r
5018 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
5019 let __noDynamicImport;
\r
5021 * A request to resolve the type definition locations of a symbol at a given text
\r
5022 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
5023 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
\r
5024 * Thenable that resolves to such.
\r
5026 var TypeDefinitionRequest;
\r
5027 (function (TypeDefinitionRequest) {
\r
5028 TypeDefinitionRequest.method = 'textDocument/typeDefinition';
\r
5029 TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);
\r
5030 /** @deprecated Use TypeDefinitionRequest.type */
\r
5031 TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5032 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));
\r
5037 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5040 /* --------------------------------------------------------------------------------------------
\r
5041 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5042 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5043 * ------------------------------------------------------------------------------------------ */
\r
5045 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5046 const messages_1 = __webpack_require__(21);
\r
5048 * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
\r
5050 var WorkspaceFoldersRequest;
\r
5051 (function (WorkspaceFoldersRequest) {
\r
5052 WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');
\r
5053 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));
\r
5055 * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace
\r
5056 * folder configuration changes.
\r
5058 var DidChangeWorkspaceFoldersNotification;
\r
5059 (function (DidChangeWorkspaceFoldersNotification) {
\r
5060 DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');
\r
5061 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));
\r
5066 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5069 /* --------------------------------------------------------------------------------------------
\r
5070 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5071 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5072 * ------------------------------------------------------------------------------------------ */
\r
5074 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5075 const messages_1 = __webpack_require__(21);
\r
5077 * The 'workspace/configuration' request is sent from the server to the client to fetch a certain
\r
5078 * configuration setting.
\r
5080 * This pull model replaces the old push model were the client signaled configuration change via an
\r
5081 * event. If the server still needs to react to configuration changes (since the server caches the
\r
5082 * result of `workspace/configuration` requests) the server should register for an empty configuration
\r
5083 * change event and empty the cache if such an event is received.
\r
5085 var ConfigurationRequest;
\r
5086 (function (ConfigurationRequest) {
\r
5087 ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');
\r
5088 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));
\r
5093 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5096 /* --------------------------------------------------------------------------------------------
\r
5097 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5098 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5099 * ------------------------------------------------------------------------------------------ */
\r
5101 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5102 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5103 const messages_1 = __webpack_require__(21);
\r
5105 * A request to list all color symbols found in a given text document. The request's
\r
5106 * parameter is of type [DocumentColorParams](#DocumentColorParams) the
\r
5107 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
\r
5108 * that resolves to such.
\r
5110 var DocumentColorRequest;
\r
5111 (function (DocumentColorRequest) {
\r
5112 DocumentColorRequest.method = 'textDocument/documentColor';
\r
5113 DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);
\r
5114 /** @deprecated Use DocumentColorRequest.type */
\r
5115 DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5116 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));
\r
5118 * A request to list all presentation for a color. The request's
\r
5119 * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the
\r
5120 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
\r
5121 * that resolves to such.
\r
5123 var ColorPresentationRequest;
\r
5124 (function (ColorPresentationRequest) {
\r
5125 ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');
\r
5126 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));
\r
5131 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5135 /*---------------------------------------------------------------------------------------------
\r
5136 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5137 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5138 *--------------------------------------------------------------------------------------------*/
\r
5139 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5140 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5141 const messages_1 = __webpack_require__(21);
\r
5143 * Enum of known range kinds
\r
5145 var FoldingRangeKind;
\r
5146 (function (FoldingRangeKind) {
\r
5148 * Folding range for a comment
\r
5150 FoldingRangeKind["Comment"] = "comment";
\r
5152 * Folding range for a imports or includes
\r
5154 FoldingRangeKind["Imports"] = "imports";
\r
5156 * Folding range for a region (e.g. `#region`)
\r
5158 FoldingRangeKind["Region"] = "region";
\r
5159 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
\r
5161 * A request to provide folding ranges in a document. The request's
\r
5162 * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the
\r
5163 * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable
\r
5164 * that resolves to such.
\r
5166 var FoldingRangeRequest;
\r
5167 (function (FoldingRangeRequest) {
\r
5168 FoldingRangeRequest.method = 'textDocument/foldingRange';
\r
5169 FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);
\r
5170 /** @deprecated Use FoldingRangeRequest.type */
\r
5171 FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5172 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));
\r
5177 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5180 /* --------------------------------------------------------------------------------------------
\r
5181 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5182 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5183 * ------------------------------------------------------------------------------------------ */
\r
5185 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5186 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5187 const messages_1 = __webpack_require__(21);
\r
5188 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
5189 let __noDynamicImport;
\r
5191 * A request to resolve the type definition locations of a symbol at a given text
\r
5192 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
5193 * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)
\r
5194 * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves
\r
5197 var DeclarationRequest;
\r
5198 (function (DeclarationRequest) {
\r
5199 DeclarationRequest.method = 'textDocument/declaration';
\r
5200 DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);
\r
5201 /** @deprecated Use DeclarationRequest.type */
\r
5202 DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5203 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));
\r
5208 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5212 /*---------------------------------------------------------------------------------------------
\r
5213 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5214 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5215 *--------------------------------------------------------------------------------------------*/
\r
5216 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5217 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5218 const messages_1 = __webpack_require__(21);
\r
5220 * A request to provide selection ranges in a document. The request's
\r
5221 * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the
\r
5222 * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable
\r
5223 * that resolves to such.
\r
5225 var SelectionRangeRequest;
\r
5226 (function (SelectionRangeRequest) {
\r
5227 SelectionRangeRequest.method = 'textDocument/selectionRange';
\r
5228 SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);
\r
5229 /** @deprecated Use SelectionRangeRequest.type */
\r
5230 SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5231 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));
\r
5236 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5239 /* --------------------------------------------------------------------------------------------
\r
5240 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5241 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5242 * ------------------------------------------------------------------------------------------ */
\r
5244 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5245 const vscode_jsonrpc_1 = __webpack_require__(5);
\r
5246 const messages_1 = __webpack_require__(21);
\r
5247 var WorkDoneProgress;
\r
5248 (function (WorkDoneProgress) {
\r
5249 WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();
\r
5250 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));
\r
5252 * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress
\r
5253 * reporting from the server.
\r
5255 var WorkDoneProgressCreateRequest;
\r
5256 (function (WorkDoneProgressCreateRequest) {
\r
5257 WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');
\r
5258 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));
\r
5260 * The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress
\r
5261 * initiated on the server side.
\r
5263 var WorkDoneProgressCancelNotification;
\r
5264 (function (WorkDoneProgressCancelNotification) {
\r
5265 WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');
\r
5266 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));
\r
5271 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5274 /* --------------------------------------------------------------------------------------------
\r
5275 * Copyright (c) TypeFox and others. All rights reserved.
\r
5276 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5277 * ------------------------------------------------------------------------------------------ */
\r
5279 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5280 const messages_1 = __webpack_require__(21);
\r
5282 * A request to result a `CallHierarchyItem` in a document at a given position.
\r
5283 * Can be used as an input to a incoming or outgoing call hierarchy.
\r
5285 * @since 3.16.0 - Proposed state
\r
5287 var CallHierarchyPrepareRequest;
\r
5288 (function (CallHierarchyPrepareRequest) {
\r
5289 CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';
\r
5290 CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);
\r
5291 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));
\r
5293 * A request to resolve the incoming calls for a given `CallHierarchyItem`.
\r
5295 * @since 3.16.0 - Proposed state
\r
5297 var CallHierarchyIncomingCallsRequest;
\r
5298 (function (CallHierarchyIncomingCallsRequest) {
\r
5299 CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';
\r
5300 CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);
\r
5301 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));
\r
5303 * A request to resolve the outgoing calls for a given `CallHierarchyItem`.
\r
5305 * @since 3.16.0 - Proposed state
\r
5307 var CallHierarchyOutgoingCallsRequest;
\r
5308 (function (CallHierarchyOutgoingCallsRequest) {
\r
5309 CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';
\r
5310 CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);
\r
5311 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));
\r
5316 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5319 /* --------------------------------------------------------------------------------------------
\r
5320 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5321 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5322 * ------------------------------------------------------------------------------------------ */
\r
5324 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5325 const messages_1 = __webpack_require__(21);
\r
5327 * A set of predefined token types. This set is not fixed
\r
5328 * an clients can specify additional token types via the
\r
5329 * corresponding client capabilities.
\r
5331 * @since 3.16.0 - Proposed state
\r
5333 var SemanticTokenTypes;
\r
5334 (function (SemanticTokenTypes) {
\r
5335 SemanticTokenTypes["comment"] = "comment";
\r
5336 SemanticTokenTypes["keyword"] = "keyword";
\r
5337 SemanticTokenTypes["string"] = "string";
\r
5338 SemanticTokenTypes["number"] = "number";
\r
5339 SemanticTokenTypes["regexp"] = "regexp";
\r
5340 SemanticTokenTypes["operator"] = "operator";
\r
5341 SemanticTokenTypes["namespace"] = "namespace";
\r
5342 SemanticTokenTypes["type"] = "type";
\r
5343 SemanticTokenTypes["struct"] = "struct";
\r
5344 SemanticTokenTypes["class"] = "class";
\r
5345 SemanticTokenTypes["interface"] = "interface";
\r
5346 SemanticTokenTypes["enum"] = "enum";
\r
5347 SemanticTokenTypes["typeParameter"] = "typeParameter";
\r
5348 SemanticTokenTypes["function"] = "function";
\r
5349 SemanticTokenTypes["member"] = "member";
\r
5350 SemanticTokenTypes["property"] = "property";
\r
5351 SemanticTokenTypes["macro"] = "macro";
\r
5352 SemanticTokenTypes["variable"] = "variable";
\r
5353 SemanticTokenTypes["parameter"] = "parameter";
\r
5354 SemanticTokenTypes["label"] = "label";
\r
5355 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));
\r
5357 * A set of predefined token modifiers. This set is not fixed
\r
5358 * an clients can specify additional token types via the
\r
5359 * corresponding client capabilities.
\r
5361 * @since 3.16.0 - Proposed state
\r
5363 var SemanticTokenModifiers;
\r
5364 (function (SemanticTokenModifiers) {
\r
5365 SemanticTokenModifiers["documentation"] = "documentation";
\r
5366 SemanticTokenModifiers["declaration"] = "declaration";
\r
5367 SemanticTokenModifiers["definition"] = "definition";
\r
5368 SemanticTokenModifiers["reference"] = "reference";
\r
5369 SemanticTokenModifiers["static"] = "static";
\r
5370 SemanticTokenModifiers["abstract"] = "abstract";
\r
5371 SemanticTokenModifiers["deprecated"] = "deprecated";
\r
5372 SemanticTokenModifiers["async"] = "async";
\r
5373 SemanticTokenModifiers["volatile"] = "volatile";
\r
5374 SemanticTokenModifiers["readonly"] = "readonly";
\r
5375 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));
\r
5377 * @since 3.16.0 - Proposed state
\r
5379 var SemanticTokens;
\r
5380 (function (SemanticTokens) {
\r
5381 function is(value) {
\r
5382 const candidate = value;
\r
5383 return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&
\r
5384 Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');
\r
5386 SemanticTokens.is = is;
\r
5387 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));
\r
5389 * @since 3.16.0 - Proposed state
\r
5391 var SemanticTokensRequest;
\r
5392 (function (SemanticTokensRequest) {
\r
5393 SemanticTokensRequest.method = 'textDocument/semanticTokens';
\r
5394 SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);
\r
5395 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));
\r
5397 * @since 3.16.0 - Proposed state
\r
5399 var SemanticTokensEditsRequest;
\r
5400 (function (SemanticTokensEditsRequest) {
\r
5401 SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';
\r
5402 SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);
\r
5403 })(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));
\r
5405 * @since 3.16.0 - Proposed state
\r
5407 var SemanticTokensRangeRequest;
\r
5408 (function (SemanticTokensRangeRequest) {
\r
5409 SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';
\r
5410 SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);
\r
5411 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));
\r
5416 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5420 Object.defineProperty(exports, "__esModule", ({ value: true }));
5421 exports.Ctx = void 0;
5422 const coc_nvim_1 = __webpack_require__(1);
5423 const vscode_languageserver_protocol_1 = __webpack_require__(4);
5424 const config_1 = __webpack_require__(34);
5425 const semantic_highlighting_1 = __webpack_require__(35);
5426 class ClangdExtensionFeature {
5429 fillClientCapabilities(capabilities) {
5431 const textDocument = capabilities.textDocument;
5432 // @ts-ignore: clangd extension
5433 (_a = textDocument.completion) === null || _a === void 0 ? void 0 : _a.editsNearCursor = true;
5437 constructor(context) {
5438 this.context = context;
5440 this.config = new config_1.Config();
5442 async startServer(bin) {
5443 const old = this.client;
5449 args: this.config.arguments,
5451 if (!!this.config.trace) {
5452 exec.options = { env: { CLANGD_TRACE: this.config.trace } };
5454 const serverOptions = exec;
5455 const outputChannel = coc_nvim_1.workspace.createOutputChannel('clangd');
5456 const initializationOptions = { clangdFileStatus: true, fallbackFlags: this.config.fallbackFlags };
5457 if (this.config.compilationDatabasePath) {
5458 initializationOptions.compilationDatabasePath = this.config.compilationDatabasePath;
5460 const clientOptions = {
5462 { scheme: 'file', language: 'c' },
5463 { scheme: 'file', language: 'cpp' },
5464 { scheme: 'file', language: 'objc' },
5465 { scheme: 'file', language: 'objcpp' },
5466 { scheme: 'file', language: 'objective-c' },
5467 { scheme: 'file', language: 'objective-cpp' },
5468 { scheme: 'file', language: 'cuda' },
5469 { scheme: 'file', language: 'arduino' },
5471 initializationOptions,
5472 disableDiagnostics: this.config.disableDiagnostics,
5474 disableSnippetCompletion: this.config.disableSnippetCompletion,
5477 provideOnTypeFormattingEdits: (document, position, ch, options, token, next) => {
5478 // coc sends "\n" when exiting insert mode, when there is no newline added to the doc.
5481 return next(document, position, ch, options, token);
5483 provideCompletionItem: async (document, position, context, token, next) => {
5484 const list = await next(document, position, context, token);
5487 if (!this.config.serverCompletionRanking)
5489 const items = (Array.isArray(list) ? list : list.items).map((item) => {
5491 const start = (_a = item.textEdit) === null || _a === void 0 ? void 0 : _a.range.start;
5493 const prefix = document.getText(vscode_languageserver_protocol_1.Range.create(start, position));
5495 item.filterText = prefix + '_' + item.filterText;
5499 return vscode_languageserver_protocol_1.CompletionList.create(items, true);
5501 provideWorkspaceSymbols: async (query, token, next) => {
5502 const symbols = await next(query, token);
5505 return symbols.map((symbol) => {
5506 if (symbol.containerName) {
5507 symbol.name = `${symbol.containerName}::${symbol.name}`;
5509 symbol.containerName = '';
5515 const client = new coc_nvim_1.LanguageClient('clangd', serverOptions, clientOptions);
5516 client.registerFeature(new ClangdExtensionFeature());
5517 if (this.config.semanticHighlighting) {
5518 const lspCxx = await coc_nvim_1.workspace.nvim.call('exists', 'g:lsp_cxx_hl_loaded');
5520 client.registerFeature(new semantic_highlighting_1.SemanticHighlightingFeature(client, this.context));
5523 this.context.subscriptions.push(coc_nvim_1.services.registLanguageClient(client));
5524 await client.onReady();
5525 this.client = client;
5527 get subscriptions() {
5528 return this.context.subscriptions;
5536 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5540 Object.defineProperty(exports, "__esModule", ({ value: true }));
5541 exports.Config = void 0;
5542 const coc_nvim_1 = __webpack_require__(1);
5545 this.cfg = coc_nvim_1.workspace.getConfiguration('clangd');
5548 return this.cfg.get('enabled');
5550 get disableDiagnostics() {
5551 return this.cfg.get('disableDiagnostics');
5553 get disableSnippetCompletion() {
5554 return this.cfg.get('disableSnippetCompletion');
5557 return this.cfg.get('arguments', []);
5560 return this.cfg.get('trace', '');
5562 get fallbackFlags() {
5563 return this.cfg.get('fallbackFlags', []);
5565 get semanticHighlighting() {
5566 return this.cfg.get('semanticHighlighting');
5568 get showDBChangedNotification() {
5569 return this.cfg.get('showDBChangedNotification');
5571 get compilationDatabasePath() {
5572 return this.cfg.get('compilationDatabasePath');
5574 get serverCompletionRanking() {
5575 return this.cfg.get('serverCompletionRanking');
5578 exports.Config = Config;
5583 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5587 Object.defineProperty(exports, "__esModule", ({ value: true }));
5588 exports.SemanticHighlightingFeature = void 0;
5589 const coc_nvim_1 = __webpack_require__(1);
5590 const vscode_languageserver_protocol_1 = __webpack_require__(4);
5591 class SemanticHighlightingFeature {
5592 constructor(client, context) {
5593 this.scopeTable = [];
5594 // Last tokens seen: bufTokens[bufnr][linenr] = [tokens...]
5595 this.bufTokens = {};
5596 context.subscriptions.push(client.onDidChangeState(({ newState }) => {
5597 if (newState === coc_nvim_1.State.Running) {
5598 const notification = new vscode_languageserver_protocol_1.NotificationType('textDocument/semanticHighlighting');
5599 client.onNotification(notification, this.handleNotification.bind(this));
5603 initialize(capabilities) {
5604 const serverCapabilities = capabilities;
5605 if (!serverCapabilities.semanticHighlighting)
5607 this.scopeTable = serverCapabilities.semanticHighlighting.scopes;
5609 fillClientCapabilities(capabilities) {
5610 const textDocumentCapabilities = capabilities.textDocument;
5611 textDocumentCapabilities.semanticHighlightingCapabilities = {
5612 semanticHighlighting: true,
5615 async handleNotification(params) {
5616 // use https://github.com/jackguo380/vim-lsp-cxx-highlight to do highlighting
5617 // first, assemble the full list of tokens.
5618 const doc = coc_nvim_1.workspace.getDocument(params.textDocument.uri);
5619 // Create implicit previous state if it doesn't exist.
5620 if (!(doc.bufnr in this.bufTokens))
5621 this.bufTokens[doc.bufnr] = [];
5622 const lines = this.bufTokens[doc.bufnr];
5623 // Update changed lines in place.
5624 for (const line of params.lines) {
5625 while (line.line >= lines.length)
5627 lines[line.line] = this.decodeTokens(line.tokens);
5631 for (const [line, tokens] of lines.entries()) {
5632 for (const token of tokens) {
5633 if (token.kind === 'InactiveCode') {
5634 skipped.push(vscode_languageserver_protocol_1.Range.create(line, token.character, line, token.character + token.length));
5640 ranges: [vscode_languageserver_protocol_1.Range.create(line, token.character, line, token.character + token.length)],
5641 parentKind: 'Unknown',
5647 await coc_nvim_1.workspace.nvim.call('lsp_cxx_hl#hl#notify_symbols', [doc.bufnr, symbols]);
5648 if (skipped.length) {
5649 await coc_nvim_1.workspace.nvim.call('lsp_cxx_hl#hl#notify_skipped', [doc.bufnr, skipped]);
5652 // Converts a string of base64 encoded tokens into the corresponding array of SemanticHighlightingToken.
5653 decodeTokens(tokens) {
5654 const scopeMask = 0xffff;
5655 const lenShift = 0x10;
5656 const uint32Size = 4;
5657 const buf = Buffer.from(tokens, 'base64');
5658 const retTokens = [];
5659 for (let i = 0, end = buf.length / uint32Size; i < end; i += 2) {
5660 const start = buf.readUInt32BE(i * uint32Size);
5661 const lenKind = buf.readUInt32BE((i + 1) * uint32Size);
5662 const scopeIndex = lenKind & scopeMask;
5663 const len = lenKind >>> lenShift;
5664 const kind = this.scopeTable[scopeIndex][0];
5665 retTokens.push({ character: start, scopeIndex: scopeIndex, length: len, kind: this.decodeKind(kind) });
5670 // https://github.com/llvm/llvm-project/blob/9adc7fc3cdf571bd70d5f8bda4e2e9c233c5fd63/clang-tools-extra/clangd/SemanticHighlighting.cpp#L477
5672 case 'entity.name.function.cpp':
5674 case 'entity.name.function.method.cpp':
5676 case 'entity.name.function.method.static.cpp':
5677 return 'StaticMethod';
5678 case 'variable.other.cpp':
5680 case 'variable.other.local.cpp':
5681 return 'LocalVariable';
5682 case 'variable.parameter.cpp':
5684 case 'variable.other.field.cpp':
5686 case 'variable.other.field.static.cpp':
5687 return 'StaticField';
5688 case 'entity.name.type.class.cpp':
5690 case 'entity.name.type.enum.cpp':
5692 case 'variable.other.enummember.cpp':
5693 return 'EnumConstant';
5694 case 'entity.name.type.typedef.cpp':
5696 case 'entity.name.type.dependent.cpp':
5697 return 'DependentType';
5698 case 'entity.name.other.dependent.cpp':
5699 return 'DependentName';
5700 case 'entity.name.namespace.cpp':
5702 case 'entity.name.type.template.cpp':
5703 return 'TemplateParameter';
5704 case 'entity.name.type.concept.cpp':
5706 case 'storage.type.primitive.cpp':
5708 case 'entity.name.function.preprocessor.cpp':
5710 case 'meta.disabled':
5711 return 'InactiveCode';
5717 exports.SemanticHighlightingFeature = SemanticHighlightingFeature;
5722 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5726 Object.defineProperty(exports, "__esModule", ({ value: true }));
5727 exports.FileStatus = void 0;
5728 const coc_nvim_1 = __webpack_require__(1);
5731 this.statuses = new Map();
5732 this.statusBarItem = coc_nvim_1.workspace.createStatusBarItem(0);
5734 onFileUpdated(status) {
5735 this.statuses.set(status.uri, status);
5736 this.updateStatus();
5738 async updateStatus() {
5739 const doc = await coc_nvim_1.workspace.document;
5743 const status = this.statuses.get(doc.uri);
5745 this.statusBarItem.hide();
5748 this.statusBarItem.text = `clangd: ` + status.state;
5749 this.statusBarItem.show();
5752 this.statuses.clear();
5753 this.statusBarItem.hide();
5756 this.statusBarItem.dispose();
5759 exports.FileStatus = FileStatus;
5764 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5768 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5769 if (k2 === undefined) k2 = k;
5770 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5771 }) : (function(o, m, k, k2) {
5772 if (k2 === undefined) k2 = k;
5775 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
5776 Object.defineProperty(o, "default", { enumerable: true, value: v });
5777 }) : function(o, v) {
5780 var __importStar = (this && this.__importStar) || function (mod) {
5781 if (mod && mod.__esModule) return mod;
5783 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5784 __setModuleDefault(result, mod);
5787 Object.defineProperty(exports, "__esModule", ({ value: true }));
5788 exports.activate = void 0;
5789 const coc = __importStar(__webpack_require__(1));
5790 const common = __importStar(__webpack_require__(38));
5792 constructor(context, config) {
5793 this.context = context;
5794 this.config = config;
5797 return this.context.storagePath;
5799 slow(title, result) {
5800 coc.workspace.showMessage(title + '...');
5804 coc.workspace.showMessage(s, 'error');
5807 coc.workspace.showMessage(s);
5809 progress(title, _cancel, body) {
5810 return this.slow(title, body(() => { }));
5812 async shouldReuse(release) {
5813 coc.workspace.showMessage(`Reusing existing ${release} installation in ${this.storagePath}`);
5816 async promptReload() {
5817 await coc.commands.executeCommand('editor.action.restart');
5819 showHelp(message, url) {
5820 message += ` See ${url}.`;
5821 coc.workspace.showMessage(message);
5823 async promptUpdate(oldVersion, newVersion) {
5824 const message = `clangd ${newVersion} is available (you have ${oldVersion}). :CocCommand clangd.install, or :CocSettings to disable clangd.checkUpdates.`;
5825 coc.workspace.showMessage(message);
5827 async promptInstall(version) {
5828 const message = `clangd was not found on your PATH. :CocCommand clangd.install will install ${version}.`;
5829 coc.workspace.showMessage(message);
5832 return this.config.get('path');
5835 this.config.update('path', p, /*isUser=*/ true);
5838 // Returns the clangd path to use, or null if clangd is not installed.
5839 async function activate(context) {
5840 const cfg = coc.workspace.getConfiguration('clangd');
5841 const ui = new UI(context, cfg);
5842 context.subscriptions.push(coc.commands.registerCommand('clangd.install', async () => common.installLatest(ui)));
5843 context.subscriptions.push(coc.commands.registerCommand('clangd.update', async () => common.checkUpdates(true, ui)));
5844 const status = await common.prepare(ui, cfg.get('checkUpdates', false));
5845 return status.clangdPath;
5847 exports.activate = activate;
5852 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5856 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5857 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5858 return new (P || (P = Promise))(function (resolve, reject) {
5859 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5860 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5861 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5862 step((generator = generator.apply(thisArg, _arguments || [])).next());
5865 var __asyncValues = (this && this.__asyncValues) || function (o) {
5866 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
5867 var m = o[Symbol.asyncIterator], i;
5868 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
5869 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
5870 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
5872 Object.defineProperty(exports, "__esModule", ({ value: true }));
5873 // Automatically install clangd binary releases from GitHub.
5875 // We don't bundle them with the package because they're big; we'd have to
5876 // include all OS versions, and download them again with every extension update.
5878 // There are several entry points:
5879 // - installation explicitly requested
5880 // - checking for updates (manual or automatic)
5881 // - no usable clangd found, try to recover
5882 // These have different flows, but the same underlying mechanisms.
5883 const abort_controller_1 = __webpack_require__(39);
5884 const child_process = __webpack_require__(41);
5885 const fs = __webpack_require__(42);
5886 const node_fetch_1 = __webpack_require__(43);
5887 const os = __webpack_require__(14);
5888 const path = __webpack_require__(2);
5889 const readdirp = __webpack_require__(49);
5890 const rimraf = __webpack_require__(57);
5891 const semver = __webpack_require__(75);
5892 const stream = __webpack_require__(44);
5893 const unzipper = __webpack_require__(118);
5894 const util_1 = __webpack_require__(50);
5895 const which = __webpack_require__(216);
5896 // Main startup workflow: check whether the configured clangd binary us usable.
5897 // If not, offer to install one. If so, check for updates.
5898 function prepare(ui, checkUpdate) {
5899 return __awaiter(this, void 0, void 0, function* () {
5901 var absPath = yield util_1.promisify(which)(ui.clangdPath);
5904 // Couldn't find clangd - start recovery flow and stop extension
5906 return { clangdPath: null, background: recover(ui) };
5908 // Allow extension to load, asynchronously check for updates.
5910 clangdPath: absPath,
5911 background: checkUpdate ? checkUpdates(/*requested=*/ false, ui)
5916 exports.prepare = prepare;
5917 // The user has explicitly asked to install the latest clangd.
5918 // Do so without further prompting, or report an error.
5919 function installLatest(ui) {
5920 return __awaiter(this, void 0, void 0, function* () {
5921 const abort = new abort_controller_1.AbortController();
5923 const release = yield Github.latestRelease();
5924 const asset = yield Github.chooseAsset(release);
5925 ui.clangdPath = yield Install.install(release, asset, abort, ui);
5926 ui.promptReload(`clangd ${release.name} is now installed.`);
5929 if (!abort.signal.aborted) {
5930 console.error('Failed to install clangd: ', e);
5931 const message = `Failed to install clangd language server: ${e}\n` +
5932 'You may want to install it manually.';
5933 ui.showHelp(message, installURL);
5938 exports.installLatest = installLatest;
5939 // We have an apparently-valid clangd (`clangdPath`), check for updates.
5940 function checkUpdates(requested, ui) {
5941 return __awaiter(this, void 0, void 0, function* () {
5942 // Gather all the version information to see if there's an upgrade.
5944 var release = yield Github.latestRelease();
5945 yield Github.chooseAsset(release); // Ensure a binary for this platform.
5946 var upgrade = yield Version.upgrade(release, ui.clangdPath);
5949 console.log('Failed to check for clangd update: ', e);
5950 // We're not sure whether there's an upgrade: stay quiet unless asked.
5952 ui.error(`Failed to check for clangd update: ${e}`);
5955 console.log('Checking for clangd update: available=', upgrade.new, ' installed=', upgrade.old);
5956 // Bail out if the new version is better or comparable.
5957 if (!upgrade.upgrade) {
5959 ui.info(`clangd is up-to-date (you have ${upgrade.old}, latest is ${upgrade.new})`);
5962 ui.promptUpdate(upgrade.old, upgrade.new);
5965 exports.checkUpdates = checkUpdates;
5966 // The extension has detected clangd isn't available.
5967 // Inform the user, and if possible offer to install or adjust the path.
5968 // Unlike installLatest(), we've had no explicit user request or consent yet.
5969 function recover(ui) {
5970 return __awaiter(this, void 0, void 0, function* () {
5972 const release = yield Github.latestRelease();
5973 yield Github.chooseAsset(release); // Ensure a binary for this platform.
5974 ui.promptInstall(release.name);
5977 console.error('Auto-install failed: ', e);
5978 ui.showHelp('The clangd language server is not installed.', installURL);
5982 const installURL = 'https://clangd.llvm.org/installation.html';
5983 // The GitHub API endpoint for the latest binary clangd release.
5984 let githubReleaseURL = 'https://api.github.com/repos/clangd/clangd/releases/latest';
5985 // Set a fake URL for testing.
5986 function fakeGitHubReleaseURL(u) { githubReleaseURL = u; }
5987 exports.fakeGitHubReleaseURL = fakeGitHubReleaseURL;
5988 let lddCommand = 'ldd';
5989 function fakeLddCommand(l) { lddCommand = l; }
5990 exports.fakeLddCommand = fakeLddCommand;
5991 // Bits for talking to github's release API
5993 (function (Github) {
5994 // Fetch the metadata for the latest stable clangd release.
5995 function latestRelease() {
5996 return __awaiter(this, void 0, void 0, function* () {
5997 const response = yield node_fetch_1.default(githubReleaseURL);
5999 console.log(response.url, response.status, response.statusText);
6000 throw new Error(`Can't fetch release: ${response.statusText}`);
6002 return yield response.json();
6005 Github.latestRelease = latestRelease;
6006 // Determine which release asset should be installed for this machine.
6007 function chooseAsset(release) {
6008 return __awaiter(this, void 0, void 0, function* () {
6014 const variant = variants[os.platform()];
6015 if (variant == 'linux') {
6016 // Hardcoding this here is sad, but we'd like to offer a nice error message
6017 // without making the user download the package first.
6018 const minGlibc = new semver.Range('2.18');
6019 const oldGlibc = yield Version.oldGlibc(minGlibc);
6021 throw new Error('The clangd release is not compatible with your system ' +
6022 `(glibc ${oldGlibc.raw} < ${minGlibc.raw}). ` +
6023 'Try to install it using your package manager instead.');
6026 // 32-bit vscode is still common on 64-bit windows, so don't reject that.
6027 if (variant && (os.arch() == 'x64' || variant == 'windows')) {
6028 const asset = release.assets.find(a => a.name.indexOf(variant) >= 0);
6032 throw new Error(`No clangd ${release.name} binary available for ${os.platform()}/${os.arch()}`);
6035 Github.chooseAsset = chooseAsset;
6036 })(Github || (Github = {}));
6037 // Functions to download and install the releases, and manage the files on disk.
6040 // <ui.storagePath>/
6043 // clangd_<version>/ (outer director from zip file)
6047 // clangd-platform-<version>.zip (deleted after extraction)
6049 (function (Install) {
6050 // Download the binary archive `asset` from a github `release` and extract it
6051 // to the extension's global storage location.
6052 // The `abort` controller is signaled if the user cancels the installation.
6053 // Returns the absolute path to the installed clangd executable.
6054 function install(release, asset, abort, ui) {
6055 return __awaiter(this, void 0, void 0, function* () {
6056 const dirs = yield createDirs(ui);
6057 const extractRoot = path.join(dirs.install, release.tag_name);
6058 if (yield util_1.promisify(fs.exists)(extractRoot)) {
6059 const reuse = yield ui.shouldReuse(release.name);
6060 if (reuse === undefined) {
6061 // User dismissed prompt, bail out.
6063 throw new Error(`clangd ${release.name} already installed!`);
6066 // Find clangd within the existing directory.
6067 let files = (yield readdirp.promise(extractRoot)).map(e => e.fullPath);
6068 return findExecutable(files);
6071 // Delete the old version.
6072 yield util_1.promisify(rimraf)(extractRoot);
6073 // continue with installation.
6076 const zipFile = path.join(dirs.download, asset.name);
6077 yield download(asset.browser_download_url, zipFile, abort, ui);
6078 const archive = yield unzipper.Open.file(zipFile);
6079 const executable = findExecutable(archive.files.map(f => f.path));
6080 yield ui.slow(`Extracting ${asset.name}`, archive.extract({ path: extractRoot }));
6081 const clangdPath = path.join(extractRoot, executable);
6082 yield fs.promises.chmod(clangdPath, 0o755);
6083 yield fs.promises.unlink(zipFile);
6087 Install.install = install;
6088 // Create the 'install' and 'download' directories, and return absolute paths.
6089 function createDirs(ui) {
6090 return __awaiter(this, void 0, void 0, function* () {
6091 const install = path.join(ui.storagePath, 'install');
6092 const download = path.join(ui.storagePath, 'download');
6093 for (const dir of [install, download])
6094 yield fs.promises.mkdir(dir, { 'recursive': true });
6095 return { install: install, download: download };
6098 // Find the clangd executable within a set of files.
6099 function findExecutable(paths) {
6100 const filename = os.platform() == 'win32' ? 'clangd.exe' : 'clangd';
6101 const entry = paths.find(f => path.posix.basename(f) == filename ||
6102 path.win32.basename(f) == filename);
6104 throw new Error('Didn\'t find a clangd executable!');
6107 // Downloads `url` to a local file `dest` (whose parent should exist).
6108 // A progress dialog is shown, if it is cancelled then `abort` is signaled.
6109 function download(url, dest, abort, ui) {
6110 return __awaiter(this, void 0, void 0, function* () {
6111 console.log('Downloading ', url, ' to ', dest);
6112 return ui.progress(`Downloading ${path.basename(dest)}`, abort, (progress) => __awaiter(this, void 0, void 0, function* () {
6113 const response = yield node_fetch_1.default(url, { signal: abort.signal });
6115 throw new Error(`Failed to download $url`);
6116 const size = Number(response.headers.get('content-length'));
6118 response.body.on('data', (chunk) => {
6119 read += chunk.length;
6120 progress(read / size);
6122 const out = fs.createWriteStream(dest);
6123 yield util_1.promisify(stream.pipeline)(response.body, out).catch(e => {
6124 // Clean up the partial file if the download failed.
6125 fs.unlink(dest, (_) => null); // Don't wait, and ignore error.
6131 })(Install || (Install = {}));
6132 // Functions dealing with clangd versions.
6134 // We parse both github release numbers and installed `clangd --version` output
6135 // by treating them as SemVer ranges, and offer an upgrade if the version
6136 // is unambiguously newer.
6138 // These functions throw if versions can't be parsed (e.g. installed clangd
6139 // is a vendor-modified version).
6141 (function (Version) {
6142 function upgrade(release, clangdPath) {
6143 return __awaiter(this, void 0, void 0, function* () {
6144 const releasedVer = released(release);
6145 const installedVer = yield installed(clangdPath);
6147 old: installedVer.raw,
6148 new: releasedVer.raw,
6149 upgrade: rangeGreater(releasedVer, installedVer)
6153 Version.upgrade = upgrade;
6157 // Get the version of an installed clangd binary using `clangd --version`.
6158 function installed(clangdPath) {
6159 return __awaiter(this, void 0, void 0, function* () {
6160 const output = yield run(clangdPath, ['--version']);
6161 console.log(clangdPath, ' --version output: ', output);
6162 const prefix = 'clangd version ';
6163 if (!output.startsWith(prefix))
6164 throw new Error(`Couldn't parse clangd --version output: ${output}`);
6165 const rawVersion = output.substr(prefix.length).split(' ', 1)[0];
6166 return new semver.Range(rawVersion, loose);
6169 // Get the version of a github release, by parsing the tag or name.
6170 function released(release) {
6171 // Prefer the tag name, but fall back to the release name.
6172 return (!semver.validRange(release.tag_name, loose) &&
6173 semver.validRange(release.name, loose))
6174 ? new semver.Range(release.name, loose)
6175 : new semver.Range(release.tag_name, loose);
6177 // Detect the (linux) system's glibc version. If older than `min`, return it.
6178 function oldGlibc(min) {
6179 return __awaiter(this, void 0, void 0, function* () {
6180 // ldd is distributed with glibc, so ldd --version should be a good proxy.
6181 const output = yield run(lddCommand, ['--version']);
6182 // The first line is e.g. "ldd (Debian GLIBC 2.29-9) 2.29".
6183 const line = output.split('\n', 1)[0];
6184 // Require some confirmation this is [e]glibc, and a plausible
6186 const match = line.match(/^ldd .*glibc.* (\d+(?:\.\d+)+)[^ ]*$/i);
6187 if (!match || !semver.validRange(match[1], loose)) {
6188 console.error(`Can't glibc version from ldd --version output: ${line}`);
6191 const version = new semver.Range(match[1], loose);
6192 console.log('glibc is', version.raw, 'min is', min.raw);
6193 return rangeGreater(min, version) ? version : null;
6196 Version.oldGlibc = oldGlibc;
6197 // Run a system command and capture any stdout produced.
6198 function run(command, flags) {
6200 return __awaiter(this, void 0, void 0, function* () {
6201 const child = child_process.spawn(command, flags, { stdio: ['ignore', 'pipe', 'ignore'] });
6204 for (var _b = __asyncValues(child.stdout), _c; _c = yield _b.next(), !_c.done;) {
6205 const chunk = _c.value;
6209 catch (e_1_1) { e_1 = { error: e_1_1 }; }
6212 if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
6214 finally { if (e_1) throw e_1.error; }
6219 function rangeGreater(newVer, oldVer) {
6220 return semver.gtr(semver.minVersion(newVer), oldVer);
6222 })(Version || (Version = {}));
6223 //# sourceMappingURL=index.js.map
6227 /***/ ((module, exports, __webpack_require__) => {
6231 * @author Toru Nagashima <https://github.com/mysticatea>
6232 * See LICENSE file in root directory for full license.
6236 Object.defineProperty(exports, "__esModule", ({ value: true }));
6238 var eventTargetShim = __webpack_require__(40);
6242 * @see https://dom.spec.whatwg.org/#abortsignal
6244 class AbortSignal extends eventTargetShim.EventTarget {
6246 * AbortSignal cannot be constructed directly.
6250 throw new TypeError("AbortSignal cannot be constructed directly");
6253 * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
6256 const aborted = abortedFlags.get(this);
6257 if (typeof aborted !== "boolean") {
6258 throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
6263 eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort");
6265 * Create an AbortSignal object.
6267 function createAbortSignal() {
6268 const signal = Object.create(AbortSignal.prototype);
6269 eventTargetShim.EventTarget.call(signal);
6270 abortedFlags.set(signal, false);
6274 * Abort a given signal.
6276 function abortSignal(signal) {
6277 if (abortedFlags.get(signal) !== false) {
6280 abortedFlags.set(signal, true);
6281 signal.dispatchEvent({ type: "abort" });
6284 * Aborted flag for each instances.
6286 const abortedFlags = new WeakMap();
6287 // Properties should be enumerable.
6288 Object.defineProperties(AbortSignal.prototype, {
6289 aborted: { enumerable: true },
6291 // `toString()` should return `"[object AbortSignal]"`
6292 if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
6293 Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
6295 value: "AbortSignal",
6300 * The AbortController.
6301 * @see https://dom.spec.whatwg.org/#abortcontroller
6303 class AbortController {
6305 * Initialize this controller.
6308 signals.set(this, createAbortSignal());
6311 * Returns the `AbortSignal` object associated with this object.
6314 return getSignal(this);
6317 * Abort and signal to any observers that the associated activity is to be aborted.
6320 abortSignal(getSignal(this));
6324 * Associated signals.
6326 const signals = new WeakMap();
6328 * Get the associated signal of a given controller.
6330 function getSignal(controller) {
6331 const signal = signals.get(controller);
6332 if (signal == null) {
6333 throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
6337 // Properties should be enumerable.
6338 Object.defineProperties(AbortController.prototype, {
6339 signal: { enumerable: true },
6340 abort: { enumerable: true },
6342 if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
6343 Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
6345 value: "AbortController",
6349 exports.AbortController = AbortController;
6350 exports.AbortSignal = AbortSignal;
6351 exports.default = AbortController;
6353 module.exports = AbortController
6354 module.exports.AbortController = module.exports.default = AbortController
6355 module.exports.AbortSignal = AbortSignal
6356 //# sourceMappingURL=abort-controller.js.map
6361 /***/ ((module, exports) => {
6365 * @author Toru Nagashima <https://github.com/mysticatea>
6366 * @copyright 2015 Toru Nagashima. All rights reserved.
6367 * See LICENSE file in root directory for full license.
6371 Object.defineProperty(exports, "__esModule", ({ value: true }));
6374 * @typedef {object} PrivateData
6375 * @property {EventTarget} eventTarget The event target.
6376 * @property {{type:string}} event The original event object.
6377 * @property {number} eventPhase The current event phase.
6378 * @property {EventTarget|null} currentTarget The current event target.
6379 * @property {boolean} canceled The flag to prevent default.
6380 * @property {boolean} stopped The flag to stop propagation.
6381 * @property {boolean} immediateStopped The flag to stop propagation immediately.
6382 * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
6383 * @property {number} timeStamp The unix time.
6388 * Private data for event wrappers.
6389 * @type {WeakMap<Event, PrivateData>}
6392 const privateData = new WeakMap();
6395 * Cache for wrapper classes.
6396 * @type {WeakMap<Object, Function>}
6399 const wrappers = new WeakMap();
6403 * @param {Event} event The event object to get private data.
6404 * @returns {PrivateData} The private data of the event.
6407 function pd(event) {
6408 const retv = privateData.get(event);
6411 "'this' is expected an Event object, but got",
6418 * https://dom.spec.whatwg.org/#set-the-canceled-flag
6419 * @param data {PrivateData} private data.
6421 function setCancelFlag(data) {
6422 if (data.passiveListener != null) {
6424 typeof console !== "undefined" &&
6425 typeof console.error === "function"
6428 "Unable to preventDefault inside passive event listener invocation.",
6429 data.passiveListener
6434 if (!data.event.cancelable) {
6438 data.canceled = true;
6439 if (typeof data.event.preventDefault === "function") {
6440 data.event.preventDefault();
6445 * @see https://dom.spec.whatwg.org/#interface-event
6449 * The event wrapper.
6451 * @param {EventTarget} eventTarget The event target of this dispatching.
6452 * @param {Event|{type:string}} event The original event to wrap.
6454 function Event(eventTarget, event) {
6455 privateData.set(this, {
6459 currentTarget: eventTarget,
6462 immediateStopped: false,
6463 passiveListener: null,
6464 timeStamp: event.timeStamp || Date.now(),
6467 // https://heycam.github.io/webidl/#Unforgeable
6468 Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
6471 const keys = Object.keys(event);
6472 for (let i = 0; i < keys.length; ++i) {
6473 const key = keys[i];
6474 if (!(key in this)) {
6475 Object.defineProperty(this, key, defineRedirectDescriptor(key));
6480 // Should be enumerable, but class methods are not enumerable.
6483 * The type of this event.
6487 return pd(this).event.type
6491 * The target of this event.
6492 * @type {EventTarget}
6495 return pd(this).eventTarget
6499 * The target of this event.
6500 * @type {EventTarget}
6502 get currentTarget() {
6503 return pd(this).currentTarget
6507 * @returns {EventTarget[]} The composed path of this event.
6510 const currentTarget = pd(this).currentTarget;
6511 if (currentTarget == null) {
6514 return [currentTarget]
6526 * Constant of CAPTURING_PHASE.
6529 get CAPTURING_PHASE() {
6534 * Constant of AT_TARGET.
6542 * Constant of BUBBLING_PHASE.
6545 get BUBBLING_PHASE() {
6550 * The target of this event.
6554 return pd(this).eventPhase
6558 * Stop event bubbling.
6562 const data = pd(this);
6564 data.stopped = true;
6565 if (typeof data.event.stopPropagation === "function") {
6566 data.event.stopPropagation();
6571 * Stop event bubbling.
6574 stopImmediatePropagation() {
6575 const data = pd(this);
6577 data.stopped = true;
6578 data.immediateStopped = true;
6579 if (typeof data.event.stopImmediatePropagation === "function") {
6580 data.event.stopImmediatePropagation();
6585 * The flag to be bubbling.
6589 return Boolean(pd(this).event.bubbles)
6593 * The flag to be cancelable.
6597 return Boolean(pd(this).event.cancelable)
6601 * Cancel this event.
6605 setCancelFlag(pd(this));
6609 * The flag to indicate cancellation state.
6612 get defaultPrevented() {
6613 return pd(this).canceled
6617 * The flag to be composed.
6621 return Boolean(pd(this).event.composed)
6625 * The unix time of this event.
6629 return pd(this).timeStamp
6633 * The target of this event.
6634 * @type {EventTarget}
6638 return pd(this).eventTarget
6642 * The flag to stop event bubbling.
6646 get cancelBubble() {
6647 return pd(this).stopped
6649 set cancelBubble(value) {
6653 const data = pd(this);
6655 data.stopped = true;
6656 if (typeof data.event.cancelBubble === "boolean") {
6657 data.event.cancelBubble = true;
6662 * The flag to indicate cancellation state.
6667 return !pd(this).canceled
6669 set returnValue(value) {
6671 setCancelFlag(pd(this));
6676 * Initialize this event object. But do nothing under event dispatching.
6677 * @param {string} type The event type.
6678 * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
6679 * @param {boolean} [cancelable=false] The flag to be possible to cancel.
6687 // `constructor` is not enumerable.
6688 Object.defineProperty(Event.prototype, "constructor", {
6694 // Ensure `event instanceof window.Event` is `true`.
6695 if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
6696 Object.setPrototypeOf(Event.prototype, window.Event.prototype);
6698 // Make association for wrappers.
6699 wrappers.set(window.Event.prototype, Event);
6703 * Get the property descriptor to redirect a given property.
6704 * @param {string} key Property name to define property descriptor.
6705 * @returns {PropertyDescriptor} The property descriptor to redirect the property.
6708 function defineRedirectDescriptor(key) {
6711 return pd(this).event[key]
6714 pd(this).event[key] = value;
6722 * Get the property descriptor to call a given method property.
6723 * @param {string} key Property name to define property descriptor.
6724 * @returns {PropertyDescriptor} The property descriptor to call the method property.
6727 function defineCallDescriptor(key) {
6730 const event = pd(this).event;
6731 return event[key].apply(event, arguments)
6739 * Define new wrapper class.
6740 * @param {Function} BaseEvent The base wrapper class.
6741 * @param {Object} proto The prototype of the original event.
6742 * @returns {Function} The defined wrapper class.
6745 function defineWrapper(BaseEvent, proto) {
6746 const keys = Object.keys(proto);
6747 if (keys.length === 0) {
6752 function CustomEvent(eventTarget, event) {
6753 BaseEvent.call(this, eventTarget, event);
6756 CustomEvent.prototype = Object.create(BaseEvent.prototype, {
6757 constructor: { value: CustomEvent, configurable: true, writable: true },
6760 // Define accessors.
6761 for (let i = 0; i < keys.length; ++i) {
6762 const key = keys[i];
6763 if (!(key in BaseEvent.prototype)) {
6764 const descriptor = Object.getOwnPropertyDescriptor(proto, key);
6765 const isFunc = typeof descriptor.value === "function";
6766 Object.defineProperty(
6767 CustomEvent.prototype,
6770 ? defineCallDescriptor(key)
6771 : defineRedirectDescriptor(key)
6780 * Get the wrapper class of a given prototype.
6781 * @param {Object} proto The prototype of the original event to get its wrapper.
6782 * @returns {Function} The wrapper class.
6785 function getWrapper(proto) {
6786 if (proto == null || proto === Object.prototype) {
6790 let wrapper = wrappers.get(proto);
6791 if (wrapper == null) {
6792 wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
6793 wrappers.set(proto, wrapper);
6799 * Wrap a given event to management a dispatching.
6800 * @param {EventTarget} eventTarget The event target of this dispatching.
6801 * @param {Object} event The event to wrap.
6802 * @returns {Event} The wrapper instance.
6805 function wrapEvent(eventTarget, event) {
6806 const Wrapper = getWrapper(Object.getPrototypeOf(event));
6807 return new Wrapper(eventTarget, event)
6811 * Get the immediateStopped flag of a given event.
6812 * @param {Event} event The event to get.
6813 * @returns {boolean} The flag to stop propagation immediately.
6816 function isStopped(event) {
6817 return pd(event).immediateStopped
6821 * Set the current event phase of a given event.
6822 * @param {Event} event The event to set current target.
6823 * @param {number} eventPhase New event phase.
6827 function setEventPhase(event, eventPhase) {
6828 pd(event).eventPhase = eventPhase;
6832 * Set the current target of a given event.
6833 * @param {Event} event The event to set current target.
6834 * @param {EventTarget|null} currentTarget New current target.
6838 function setCurrentTarget(event, currentTarget) {
6839 pd(event).currentTarget = currentTarget;
6843 * Set a passive listener of a given event.
6844 * @param {Event} event The event to set current target.
6845 * @param {Function|null} passiveListener New passive listener.
6849 function setPassiveListener(event, passiveListener) {
6850 pd(event).passiveListener = passiveListener;
6854 * @typedef {object} ListenerNode
6855 * @property {Function} listener
6856 * @property {1|2|3} listenerType
6857 * @property {boolean} passive
6858 * @property {boolean} once
6859 * @property {ListenerNode|null} next
6864 * @type {WeakMap<object, Map<string, ListenerNode>>}
6867 const listenersMap = new WeakMap();
6872 const ATTRIBUTE = 3;
6875 * Check whether a given value is an object or not.
6876 * @param {any} x The value to check.
6877 * @returns {boolean} `true` if the value is an object.
6879 function isObject(x) {
6880 return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax
6885 * @param {EventTarget} eventTarget The event target to get.
6886 * @returns {Map<string, ListenerNode>} The listeners.
6889 function getListeners(eventTarget) {
6890 const listeners = listenersMap.get(eventTarget);
6891 if (listeners == null) {
6892 throw new TypeError(
6893 "'this' is expected an EventTarget object, but got another value."
6900 * Get the property descriptor for the event attribute of a given event.
6901 * @param {string} eventName The event name to get property descriptor.
6902 * @returns {PropertyDescriptor} The property descriptor.
6905 function defineEventAttributeDescriptor(eventName) {
6908 const listeners = getListeners(this);
6909 let node = listeners.get(eventName);
6910 while (node != null) {
6911 if (node.listenerType === ATTRIBUTE) {
6912 return node.listener
6920 if (typeof listener !== "function" && !isObject(listener)) {
6921 listener = null; // eslint-disable-line no-param-reassign
6923 const listeners = getListeners(this);
6925 // Traverse to the tail while removing old value.
6927 let node = listeners.get(eventName);
6928 while (node != null) {
6929 if (node.listenerType === ATTRIBUTE) {
6930 // Remove old value.
6931 if (prev !== null) {
6932 prev.next = node.next;
6933 } else if (node.next !== null) {
6934 listeners.set(eventName, node.next);
6936 listeners.delete(eventName);
6946 if (listener !== null) {
6949 listenerType: ATTRIBUTE,
6954 if (prev === null) {
6955 listeners.set(eventName, newNode);
6957 prev.next = newNode;
6967 * Define an event attribute (e.g. `eventTarget.onclick`).
6968 * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
6969 * @param {string} eventName The event name to define.
6972 function defineEventAttribute(eventTargetPrototype, eventName) {
6973 Object.defineProperty(
6974 eventTargetPrototype,
6976 defineEventAttributeDescriptor(eventName)
6981 * Define a custom EventTarget with event attributes.
6982 * @param {string[]} eventNames Event names for event attributes.
6983 * @returns {EventTarget} The custom EventTarget.
6986 function defineCustomEventTarget(eventNames) {
6987 /** CustomEventTarget */
6988 function CustomEventTarget() {
6989 EventTarget.call(this);
6992 CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
6994 value: CustomEventTarget,
7000 for (let i = 0; i < eventNames.length; ++i) {
7001 defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
7004 return CustomEventTarget
7010 * - This is constructor if no arguments.
7011 * - This is a function which returns a CustomEventTarget constructor if there are arguments.
7015 * class A extends EventTarget {}
7016 * class B extends EventTarget("message") {}
7017 * class C extends EventTarget("message", "error") {}
7018 * class D extends EventTarget(["message", "error"]) {}
7020 function EventTarget() {
7021 /*eslint-disable consistent-return */
7022 if (this instanceof EventTarget) {
7023 listenersMap.set(this, new Map());
7026 if (arguments.length === 1 && Array.isArray(arguments[0])) {
7027 return defineCustomEventTarget(arguments[0])
7029 if (arguments.length > 0) {
7030 const types = new Array(arguments.length);
7031 for (let i = 0; i < arguments.length; ++i) {
7032 types[i] = arguments[i];
7034 return defineCustomEventTarget(types)
7036 throw new TypeError("Cannot call a class as a function")
7037 /*eslint-enable consistent-return */
7040 // Should be enumerable, but class methods are not enumerable.
7041 EventTarget.prototype = {
7043 * Add a given listener to this event target.
7044 * @param {string} eventName The event name to add.
7045 * @param {Function} listener The listener to add.
7046 * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
7049 addEventListener(eventName, listener, options) {
7050 if (listener == null) {
7053 if (typeof listener !== "function" && !isObject(listener)) {
7054 throw new TypeError("'listener' should be a function or an object.")
7057 const listeners = getListeners(this);
7058 const optionsIsObj = isObject(options);
7059 const capture = optionsIsObj
7060 ? Boolean(options.capture)
7062 const listenerType = capture ? CAPTURE : BUBBLE;
7066 passive: optionsIsObj && Boolean(options.passive),
7067 once: optionsIsObj && Boolean(options.once),
7071 // Set it as the first node if the first node is null.
7072 let node = listeners.get(eventName);
7073 if (node === undefined) {
7074 listeners.set(eventName, newNode);
7078 // Traverse to the tail while checking duplication..
7080 while (node != null) {
7082 node.listener === listener &&
7083 node.listenerType === listenerType
7085 // Should ignore duplication.
7093 prev.next = newNode;
7097 * Remove a given listener from this event target.
7098 * @param {string} eventName The event name to remove.
7099 * @param {Function} listener The listener to remove.
7100 * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
7103 removeEventListener(eventName, listener, options) {
7104 if (listener == null) {
7108 const listeners = getListeners(this);
7109 const capture = isObject(options)
7110 ? Boolean(options.capture)
7112 const listenerType = capture ? CAPTURE : BUBBLE;
7115 let node = listeners.get(eventName);
7116 while (node != null) {
7118 node.listener === listener &&
7119 node.listenerType === listenerType
7121 if (prev !== null) {
7122 prev.next = node.next;
7123 } else if (node.next !== null) {
7124 listeners.set(eventName, node.next);
7126 listeners.delete(eventName);
7137 * Dispatch a given event.
7138 * @param {Event|{type:string}} event The event to dispatch.
7139 * @returns {boolean} `false` if canceled.
7141 dispatchEvent(event) {
7142 if (event == null || typeof event.type !== "string") {
7143 throw new TypeError('"event.type" should be a string.')
7146 // If listeners aren't registered, terminate.
7147 const listeners = getListeners(this);
7148 const eventName = event.type;
7149 let node = listeners.get(eventName);
7154 // Since we cannot rewrite several properties, so wrap object.
7155 const wrappedEvent = wrapEvent(this, event);
7157 // This doesn't process capturing phase and bubbling phase.
7158 // This isn't participating in a tree.
7160 while (node != null) {
7161 // Remove this listener if it's once
7163 if (prev !== null) {
7164 prev.next = node.next;
7165 } else if (node.next !== null) {
7166 listeners.set(eventName, node.next);
7168 listeners.delete(eventName);
7174 // Call this listener
7177 node.passive ? node.listener : null
7179 if (typeof node.listener === "function") {
7181 node.listener.call(this, wrappedEvent);
7184 typeof console !== "undefined" &&
7185 typeof console.error === "function"
7191 node.listenerType !== ATTRIBUTE &&
7192 typeof node.listener.handleEvent === "function"
7194 node.listener.handleEvent(wrappedEvent);
7197 // Break if `event.stopImmediatePropagation` was called.
7198 if (isStopped(wrappedEvent)) {
7204 setPassiveListener(wrappedEvent, null);
7205 setEventPhase(wrappedEvent, 0);
7206 setCurrentTarget(wrappedEvent, null);
7208 return !wrappedEvent.defaultPrevented
7212 // `constructor` is not enumerable.
7213 Object.defineProperty(EventTarget.prototype, "constructor", {
7219 // Ensure `eventTarget instanceof window.EventTarget` is `true`.
7221 typeof window !== "undefined" &&
7222 typeof window.EventTarget !== "undefined"
7224 Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
7227 exports.defineEventAttribute = defineEventAttribute;
7228 exports.EventTarget = EventTarget;
7229 exports.default = EventTarget;
7231 module.exports = EventTarget
7232 module.exports.EventTarget = module.exports.default = EventTarget
7233 module.exports.defineEventAttribute = defineEventAttribute
7234 //# sourceMappingURL=event-target-shim.js.map
7239 /***/ ((module) => {
7242 module.exports = require("child_process");;
7246 /***/ ((module) => {
7249 module.exports = require("fs");;
7253 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7256 __webpack_require__.r(__webpack_exports__);
7257 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7258 /* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__,
7259 /* harmony export */ "Headers": () => /* binding */ Headers,
7260 /* harmony export */ "Request": () => /* binding */ Request,
7261 /* harmony export */ "Response": () => /* binding */ Response,
7262 /* harmony export */ "FetchError": () => /* binding */ FetchError
7263 /* harmony export */ });
7264 /* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44);
7265 /* harmony import */ var http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45);
7266 /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(46);
7267 /* harmony import */ var https__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(47);
7268 /* harmony import */ var zlib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(48);
7275 // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
7277 // fix for "Readable" isn't a named export issue
7278 const Readable = stream__WEBPACK_IMPORTED_MODULE_0__.Readable;
7280 const BUFFER = Symbol('buffer');
7281 const TYPE = Symbol('type');
7287 const blobParts = arguments[0];
7288 const options = arguments[1];
7294 const a = blobParts;
7295 const length = Number(a.length);
7296 for (let i = 0; i < length; i++) {
7297 const element = a[i];
7299 if (element instanceof Buffer) {
7301 } else if (ArrayBuffer.isView(element)) {
7302 buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
7303 } else if (element instanceof ArrayBuffer) {
7304 buffer = Buffer.from(element);
7305 } else if (element instanceof Blob) {
7306 buffer = element[BUFFER];
7308 buffer = Buffer.from(typeof element === 'string' ? element : String(element));
7310 size += buffer.length;
7311 buffers.push(buffer);
7315 this[BUFFER] = Buffer.concat(buffers);
7317 let type = options && options.type !== undefined && String(options.type).toLowerCase();
7318 if (type && !/[^\u0020-\u007E]/.test(type)) {
7323 return this[BUFFER].length;
7329 return Promise.resolve(this[BUFFER].toString());
7332 const buf = this[BUFFER];
7333 const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
7334 return Promise.resolve(ab);
7337 const readable = new Readable();
7338 readable._read = function () {};
7339 readable.push(this[BUFFER]);
7340 readable.push(null);
7344 return '[object Blob]';
7347 const size = this.size;
7349 const start = arguments[0];
7350 const end = arguments[1];
7351 let relativeStart, relativeEnd;
7352 if (start === undefined) {
7354 } else if (start < 0) {
7355 relativeStart = Math.max(size + start, 0);
7357 relativeStart = Math.min(start, size);
7359 if (end === undefined) {
7361 } else if (end < 0) {
7362 relativeEnd = Math.max(size + end, 0);
7364 relativeEnd = Math.min(end, size);
7366 const span = Math.max(relativeEnd - relativeStart, 0);
7368 const buffer = this[BUFFER];
7369 const slicedBuffer = buffer.slice(relativeStart, relativeStart + span);
7370 const blob = new Blob([], { type: arguments[2] });
7371 blob[BUFFER] = slicedBuffer;
7376 Object.defineProperties(Blob.prototype, {
7377 size: { enumerable: true },
7378 type: { enumerable: true },
7379 slice: { enumerable: true }
7382 Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
7392 * FetchError interface for operational errors
7396 * Create FetchError instance
7398 * @param String message Error message for human
7399 * @param String type Error type for machine
7400 * @param String systemError For Node.js system error
7401 * @return FetchError
7403 function FetchError(message, type, systemError) {
7404 Error.call(this, message);
7406 this.message = message;
7409 // when err.type is `system`, err.code contains system error code
7411 this.code = this.errno = systemError.code;
7414 // hide custom error implementation details from end-users
7415 Error.captureStackTrace(this, this.constructor);
7418 FetchError.prototype = Object.create(Error.prototype);
7419 FetchError.prototype.constructor = FetchError;
7420 FetchError.prototype.name = 'FetchError';
7424 convert = require('encoding').convert;
7427 const INTERNALS = Symbol('Body internals');
7429 // fix an issue where "PassThrough" isn't a named export for node <10
7430 const PassThrough = stream__WEBPACK_IMPORTED_MODULE_0__.PassThrough;
7435 * Ref: https://fetch.spec.whatwg.org/#body
7437 * @param Stream body Readable stream
7438 * @param Object opts Response options
7441 function Body(body) {
7444 var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
7445 _ref$size = _ref.size;
7447 let size = _ref$size === undefined ? 0 : _ref$size;
7448 var _ref$timeout = _ref.timeout;
7449 let timeout = _ref$timeout === undefined ? 0 : _ref$timeout;
7452 // body is undefined or null
7454 } else if (isURLSearchParams(body)) {
7455 // body is a URLSearchParams
7456 body = Buffer.from(body.toString());
7457 } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {
7458 // body is ArrayBuffer
7459 body = Buffer.from(body);
7460 } else if (ArrayBuffer.isView(body)) {
7461 // body is ArrayBufferView
7462 body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
7463 } else if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) ; else {
7464 // none of the above
7465 // coerce to string then buffer
7466 body = Buffer.from(String(body));
7474 this.timeout = timeout;
7476 if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) {
7477 body.on('error', function (err) {
7478 const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err);
7479 _this[INTERNALS].error = error;
7486 return this[INTERNALS].body;
7490 return this[INTERNALS].disturbed;
7494 * Decode response as ArrayBuffer
7499 return consumeBody.call(this).then(function (buf) {
7500 return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
7505 * Return raw response as Blob
7510 let ct = this.headers && this.headers.get('content-type') || '';
7511 return consumeBody.call(this).then(function (buf) {
7512 return Object.assign(
7515 type: ct.toLowerCase()
7523 * Decode response as json
7530 return consumeBody.call(this).then(function (buffer) {
7532 return JSON.parse(buffer.toString());
7534 return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
7540 * Decode response as text
7545 return consumeBody.call(this).then(function (buffer) {
7546 return buffer.toString();
7551 * Decode response as buffer (non-spec api)
7556 return consumeBody.call(this);
7560 * Decode response as text, while automatically detecting the encoding and
7561 * trying to decode to UTF-8 (non-spec api)
7568 return consumeBody.call(this).then(function (buffer) {
7569 return convertBody(buffer, _this3.headers);
7574 // In browsers, all properties are enumerable.
7575 Object.defineProperties(Body.prototype, {
7576 body: { enumerable: true },
7577 bodyUsed: { enumerable: true },
7578 arrayBuffer: { enumerable: true },
7579 blob: { enumerable: true },
7580 json: { enumerable: true },
7581 text: { enumerable: true }
7584 Body.mixIn = function (proto) {
7585 for (const name of Object.getOwnPropertyNames(Body.prototype)) {
7586 // istanbul ignore else: future proof
7587 if (!(name in proto)) {
7588 const desc = Object.getOwnPropertyDescriptor(Body.prototype, name);
7589 Object.defineProperty(proto, name, desc);
7595 * Consume and convert an entire Body to a Buffer.
7597 * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body
7601 function consumeBody() {
7604 if (this[INTERNALS].disturbed) {
7605 return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));
7608 this[INTERNALS].disturbed = true;
7610 if (this[INTERNALS].error) {
7611 return Body.Promise.reject(this[INTERNALS].error);
7614 let body = this.body;
7617 if (body === null) {
7618 return Body.Promise.resolve(Buffer.alloc(0));
7623 body = body.stream();
7627 if (Buffer.isBuffer(body)) {
7628 return Body.Promise.resolve(body);
7631 // istanbul ignore if: should never happen
7632 if (!(body instanceof stream__WEBPACK_IMPORTED_MODULE_0__)) {
7633 return Body.Promise.resolve(Buffer.alloc(0));
7637 // get ready to actually consume the body
7642 return new Body.Promise(function (resolve, reject) {
7645 // allow timeout on slow response body
7646 if (_this4.timeout) {
7647 resTimeout = setTimeout(function () {
7649 reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout'));
7653 // handle stream errors
7654 body.on('error', function (err) {
7655 if (err.name === 'AbortError') {
7656 // if the request was aborted, reject with this Error
7660 // other errors, such as incorrect content-encoding
7661 reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err));
7665 body.on('data', function (chunk) {
7666 if (abort || chunk === null) {
7670 if (_this4.size && accumBytes + chunk.length > _this4.size) {
7672 reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size'));
7676 accumBytes += chunk.length;
7680 body.on('end', function () {
7685 clearTimeout(resTimeout);
7688 resolve(Buffer.concat(accum, accumBytes));
7690 // handle streams that have accumulated too much data (issue #414)
7691 reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err));
7698 * Detect buffer encoding and convert to target encoding
7699 * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding
7701 * @param Buffer buffer Incoming buffer
7702 * @param String encoding Target encoding
7705 function convertBody(buffer, headers) {
7706 if (typeof convert !== 'function') {
7707 throw new Error('The package `encoding` must be installed to use the textConverted() function');
7710 const ct = headers.get('content-type');
7711 let charset = 'utf-8';
7716 res = /charset=([^;]*)/i.exec(ct);
7719 // no charset in content type, peek at response body for at most 1024 bytes
7720 str = buffer.slice(0, 1024).toString();
7724 res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str);
7729 res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
7731 res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str);
7733 res.pop(); // drop last quote
7738 res = /charset=(.*)/i.exec(res.pop());
7744 res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str);
7749 charset = res.pop();
7751 // prevent decode issues when sites use incorrect encoding
7752 // ref: https://hsivonen.fi/encoding-menu/
7753 if (charset === 'gb2312' || charset === 'gbk') {
7754 charset = 'gb18030';
7758 // turn raw buffers into a single utf-8 buffer
7759 return convert(buffer, 'UTF-8', charset).toString();
7763 * Detect a URLSearchParams object
7764 * ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143
7766 * @param Object obj Object to detect by type or brand
7769 function isURLSearchParams(obj) {
7770 // Duck-typing as a necessary condition.
7771 if (typeof obj !== 'object' || typeof obj.append !== 'function' || typeof obj.delete !== 'function' || typeof obj.get !== 'function' || typeof obj.getAll !== 'function' || typeof obj.has !== 'function' || typeof obj.set !== 'function') {
7775 // Brand-checking and more duck-typing as optional condition.
7776 return obj.constructor.name === 'URLSearchParams' || Object.prototype.toString.call(obj) === '[object URLSearchParams]' || typeof obj.sort === 'function';
7780 * Check if `obj` is a W3C `Blob` object (which `File` inherits from)
7784 function isBlob(obj) {
7785 return typeof obj === 'object' && typeof obj.arrayBuffer === 'function' && typeof obj.type === 'string' && typeof obj.stream === 'function' && typeof obj.constructor === 'function' && typeof obj.constructor.name === 'string' && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]);
7789 * Clone body given Res/Req instance
7791 * @param Mixed instance Response or Request instance
7794 function clone(instance) {
7796 let body = instance.body;
7798 // don't allow cloning a used body
7799 if (instance.bodyUsed) {
7800 throw new Error('cannot clone body after it is used');
7803 // check that body is a stream and not form-data object
7804 // note: we can't clone the form-data object without having it as a dependency
7805 if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__ && typeof body.getBoundary !== 'function') {
7806 // tee instance body
7807 p1 = new PassThrough();
7808 p2 = new PassThrough();
7811 // set instance body to teed body and return the other teed body
7812 instance[INTERNALS].body = p1;
7820 * Performs the operation "extract a `Content-Type` value from |object|" as
7821 * specified in the specification:
7822 * https://fetch.spec.whatwg.org/#concept-bodyinit-extract
7824 * This function assumes that instance.body is present.
7826 * @param Mixed instance Any options.body input
7828 function extractContentType(body) {
7829 if (body === null) {
7832 } else if (typeof body === 'string') {
7834 return 'text/plain;charset=UTF-8';
7835 } else if (isURLSearchParams(body)) {
7836 // body is a URLSearchParams
7837 return 'application/x-www-form-urlencoded;charset=UTF-8';
7838 } else if (isBlob(body)) {
7840 return body.type || null;
7841 } else if (Buffer.isBuffer(body)) {
7844 } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {
7845 // body is ArrayBuffer
7847 } else if (ArrayBuffer.isView(body)) {
7848 // body is ArrayBufferView
7850 } else if (typeof body.getBoundary === 'function') {
7851 // detect form data input from form-data module
7852 return `multipart/form-data;boundary=${body.getBoundary()}`;
7853 } else if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) {
7855 // can't really do much about this
7858 // Body constructor defaults other things to string
7859 return 'text/plain;charset=UTF-8';
7864 * The Fetch Standard treats this as if "total bytes" is a property on the body.
7865 * For us, we have to explicitly get it with a function.
7867 * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes
7869 * @param Body instance Instance of Body
7870 * @return Number? Number of bytes, or null if not possible
7872 function getTotalBytes(instance) {
7873 const body = instance.body;
7876 if (body === null) {
7879 } else if (isBlob(body)) {
7881 } else if (Buffer.isBuffer(body)) {
7884 } else if (body && typeof body.getLengthSync === 'function') {
7885 // detect form data input from form-data module
7886 if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x
7887 body.hasKnownLength && body.hasKnownLength()) {
7889 return body.getLengthSync();
7899 * Write a Body to a Node.js WritableStream (e.g. http.Request) object.
7901 * @param Body instance Instance of Body
7904 function writeToStream(dest, instance) {
7905 const body = instance.body;
7908 if (body === null) {
7911 } else if (isBlob(body)) {
7912 body.stream().pipe(dest);
7913 } else if (Buffer.isBuffer(body)) {
7924 Body.Promise = global.Promise;
7929 * Headers class offers convenient helpers
7932 const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/;
7933 const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
7935 function validateName(name) {
7937 if (invalidTokenRegex.test(name) || name === '') {
7938 throw new TypeError(`${name} is not a legal HTTP header name`);
7942 function validateValue(value) {
7944 if (invalidHeaderCharRegex.test(value)) {
7945 throw new TypeError(`${value} is not a legal HTTP header value`);
7950 * Find the key in the map object given a header name.
7952 * Returns undefined if not found.
7954 * @param String name Header name
7955 * @return String|Undefined
7957 function find(map, name) {
7958 name = name.toLowerCase();
7959 for (const key in map) {
7960 if (key.toLowerCase() === name) {
7967 const MAP = Symbol('map');
7972 * @param Object headers Response headers
7976 let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
7978 this[MAP] = Object.create(null);
7980 if (init instanceof Headers) {
7981 const rawHeaders = init.raw();
7982 const headerNames = Object.keys(rawHeaders);
7984 for (const headerName of headerNames) {
7985 for (const value of rawHeaders[headerName]) {
7986 this.append(headerName, value);
7993 // We don't worry about converting prop to ByteString here as append()
7995 if (init == null) ; else if (typeof init === 'object') {
7996 const method = init[Symbol.iterator];
7997 if (method != null) {
7998 if (typeof method !== 'function') {
7999 throw new TypeError('Header pairs must be iterable');
8002 // sequence<sequence<ByteString>>
8003 // Note: per spec we have to first exhaust the lists then process them
8005 for (const pair of init) {
8006 if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') {
8007 throw new TypeError('Each header pair must be iterable');
8009 pairs.push(Array.from(pair));
8012 for (const pair of pairs) {
8013 if (pair.length !== 2) {
8014 throw new TypeError('Each header pair must be a name/value tuple');
8016 this.append(pair[0], pair[1]);
8019 // record<ByteString, ByteString>
8020 for (const key of Object.keys(init)) {
8021 const value = init[key];
8022 this.append(key, value);
8026 throw new TypeError('Provided initializer must be an object');
8031 * Return combined header value given name
8033 * @param String name Header name
8039 const key = find(this[MAP], name);
8040 if (key === undefined) {
8044 return this[MAP][key].join(', ');
8048 * Iterate over all headers
8050 * @param Function callback Executed for each item with parameters (value, name, thisArg)
8051 * @param Boolean thisArg `this` context for callback function
8055 let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
8057 let pairs = getHeaders(this);
8059 while (i < pairs.length) {
8060 var _pairs$i = pairs[i];
8061 const name = _pairs$i[0],
8062 value = _pairs$i[1];
8064 callback.call(thisArg, value, name, this);
8065 pairs = getHeaders(this);
8071 * Overwrite header values given name
8073 * @param String name Header name
8074 * @param String value Header value
8081 validateValue(value);
8082 const key = find(this[MAP], name);
8083 this[MAP][key !== undefined ? key : name] = [value];
8087 * Append a value onto existing header
8089 * @param String name Header name
8090 * @param String value Header value
8093 append(name, value) {
8097 validateValue(value);
8098 const key = find(this[MAP], name);
8099 if (key !== undefined) {
8100 this[MAP][key].push(value);
8102 this[MAP][name] = [value];
8107 * Check for header name existence
8109 * @param String name Header name
8115 return find(this[MAP], name) !== undefined;
8119 * Delete all header values given name
8121 * @param String name Header name
8127 const key = find(this[MAP], name);
8128 if (key !== undefined) {
8129 delete this[MAP][key];
8134 * Return raw headers (non-spec api)
8143 * Get an iterator on keys.
8148 return createHeadersIterator(this, 'key');
8152 * Get an iterator on values.
8157 return createHeadersIterator(this, 'value');
8161 * Get an iterator on entries.
8163 * This is the default iterator of the Headers object.
8167 [Symbol.iterator]() {
8168 return createHeadersIterator(this, 'key+value');
8171 Headers.prototype.entries = Headers.prototype[Symbol.iterator];
8173 Object.defineProperty(Headers.prototype, Symbol.toStringTag, {
8180 Object.defineProperties(Headers.prototype, {
8181 get: { enumerable: true },
8182 forEach: { enumerable: true },
8183 set: { enumerable: true },
8184 append: { enumerable: true },
8185 has: { enumerable: true },
8186 delete: { enumerable: true },
8187 keys: { enumerable: true },
8188 values: { enumerable: true },
8189 entries: { enumerable: true }
8192 function getHeaders(headers) {
8193 let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value';
8195 const keys = Object.keys(headers[MAP]).sort();
8196 return keys.map(kind === 'key' ? function (k) {
8197 return k.toLowerCase();
8198 } : kind === 'value' ? function (k) {
8199 return headers[MAP][k].join(', ');
8201 return [k.toLowerCase(), headers[MAP][k].join(', ')];
8205 const INTERNAL = Symbol('internal');
8207 function createHeadersIterator(target, kind) {
8208 const iterator = Object.create(HeadersIteratorPrototype);
8209 iterator[INTERNAL] = {
8217 const HeadersIteratorPrototype = Object.setPrototypeOf({
8219 // istanbul ignore if
8220 if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {
8221 throw new TypeError('Value of `this` is not a HeadersIterator');
8224 var _INTERNAL = this[INTERNAL];
8225 const target = _INTERNAL.target,
8226 kind = _INTERNAL.kind,
8227 index = _INTERNAL.index;
8229 const values = getHeaders(target, kind);
8230 const len = values.length;
8238 this[INTERNAL].index = index + 1;
8241 value: values[index],
8245 }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));
8247 Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {
8248 value: 'HeadersIterator',
8255 * Export the Headers object in a form that Node.js can consume.
8257 * @param Headers headers
8260 function exportNodeCompatibleHeaders(headers) {
8261 const obj = Object.assign({ __proto__: null }, headers[MAP]);
8263 // http.request() only supports string as Host header. This hack makes
8264 // specifying custom Host header possible.
8265 const hostHeaderKey = find(headers[MAP], 'Host');
8266 if (hostHeaderKey !== undefined) {
8267 obj[hostHeaderKey] = obj[hostHeaderKey][0];
8274 * Create a Headers object from an object of headers, ignoring those that do
8275 * not conform to HTTP grammar productions.
8277 * @param Object obj Object of headers
8280 function createHeadersLenient(obj) {
8281 const headers = new Headers();
8282 for (const name of Object.keys(obj)) {
8283 if (invalidTokenRegex.test(name)) {
8286 if (Array.isArray(obj[name])) {
8287 for (const val of obj[name]) {
8288 if (invalidHeaderCharRegex.test(val)) {
8291 if (headers[MAP][name] === undefined) {
8292 headers[MAP][name] = [val];
8294 headers[MAP][name].push(val);
8297 } else if (!invalidHeaderCharRegex.test(obj[name])) {
8298 headers[MAP][name] = [obj[name]];
8304 const INTERNALS$1 = Symbol('Response internals');
8306 // fix an issue where "STATUS_CODES" aren't a named export for node <10
8307 const STATUS_CODES = http__WEBPACK_IMPORTED_MODULE_1__.STATUS_CODES;
8312 * @param Stream body Readable stream
8313 * @param Object opts Response options
8318 let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
8319 let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8321 Body.call(this, body, opts);
8323 const status = opts.status || 200;
8324 const headers = new Headers(opts.headers);
8326 if (body != null && !headers.has('Content-Type')) {
8327 const contentType = extractContentType(body);
8329 headers.append('Content-Type', contentType);
8333 this[INTERNALS$1] = {
8336 statusText: opts.statusText || STATUS_CODES[status],
8338 counter: opts.counter
8343 return this[INTERNALS$1].url || '';
8347 return this[INTERNALS$1].status;
8351 * Convenience property representing if the request ended normally
8354 return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;
8358 return this[INTERNALS$1].counter > 0;
8362 return this[INTERNALS$1].statusText;
8366 return this[INTERNALS$1].headers;
8370 * Clone this response
8375 return new Response(clone(this), {
8377 status: this.status,
8378 statusText: this.statusText,
8379 headers: this.headers,
8381 redirected: this.redirected
8386 Body.mixIn(Response.prototype);
8388 Object.defineProperties(Response.prototype, {
8389 url: { enumerable: true },
8390 status: { enumerable: true },
8391 ok: { enumerable: true },
8392 redirected: { enumerable: true },
8393 statusText: { enumerable: true },
8394 headers: { enumerable: true },
8395 clone: { enumerable: true }
8398 Object.defineProperty(Response.prototype, Symbol.toStringTag, {
8405 const INTERNALS$2 = Symbol('Request internals');
8407 // fix an issue where "format", "parse" aren't a named export for node <10
8408 const parse_url = url__WEBPACK_IMPORTED_MODULE_2__.parse;
8409 const format_url = url__WEBPACK_IMPORTED_MODULE_2__.format;
8411 const streamDestructionSupported = 'destroy' in stream__WEBPACK_IMPORTED_MODULE_0__.Readable.prototype;
8414 * Check if a value is an instance of Request.
8416 * @param Mixed input
8419 function isRequest(input) {
8420 return typeof input === 'object' && typeof input[INTERNALS$2] === 'object';
8423 function isAbortSignal(signal) {
8424 const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal);
8425 return !!(proto && proto.constructor.name === 'AbortSignal');
8431 * @param Mixed input Url or Request instance
8432 * @param Object init Custom options
8436 constructor(input) {
8437 let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8442 if (!isRequest(input)) {
8443 if (input && input.href) {
8444 // in order to support Node.js' Url objects; though WHATWG's URL objects
8445 // will fall into this branch also (since their `toString()` will return
8446 // `href` property anyway)
8447 parsedURL = parse_url(input.href);
8449 // coerce input to a string before attempting to parse
8450 parsedURL = parse_url(`${input}`);
8454 parsedURL = parse_url(input.url);
8457 let method = init.method || input.method || 'GET';
8458 method = method.toUpperCase();
8460 if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) {
8461 throw new TypeError('Request with GET/HEAD method cannot have body');
8464 let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
8466 Body.call(this, inputBody, {
8467 timeout: init.timeout || input.timeout || 0,
8468 size: init.size || input.size || 0
8471 const headers = new Headers(init.headers || input.headers || {});
8473 if (inputBody != null && !headers.has('Content-Type')) {
8474 const contentType = extractContentType(inputBody);
8476 headers.append('Content-Type', contentType);
8480 let signal = isRequest(input) ? input.signal : null;
8481 if ('signal' in init) signal = init.signal;
8483 if (signal != null && !isAbortSignal(signal)) {
8484 throw new TypeError('Expected signal to be an instanceof AbortSignal');
8487 this[INTERNALS$2] = {
8489 redirect: init.redirect || input.redirect || 'follow',
8495 // node-fetch-only options
8496 this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20;
8497 this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;
8498 this.counter = init.counter || input.counter || 0;
8499 this.agent = init.agent || input.agent;
8503 return this[INTERNALS$2].method;
8507 return format_url(this[INTERNALS$2].parsedURL);
8511 return this[INTERNALS$2].headers;
8515 return this[INTERNALS$2].redirect;
8519 return this[INTERNALS$2].signal;
8523 * Clone this request
8528 return new Request(this);
8532 Body.mixIn(Request.prototype);
8534 Object.defineProperty(Request.prototype, Symbol.toStringTag, {
8541 Object.defineProperties(Request.prototype, {
8542 method: { enumerable: true },
8543 url: { enumerable: true },
8544 headers: { enumerable: true },
8545 redirect: { enumerable: true },
8546 clone: { enumerable: true },
8547 signal: { enumerable: true }
8551 * Convert a Request to Node.js http request options.
8553 * @param Request A Request instance
8554 * @return Object The options object to be passed to http.request
8556 function getNodeRequestOptions(request) {
8557 const parsedURL = request[INTERNALS$2].parsedURL;
8558 const headers = new Headers(request[INTERNALS$2].headers);
8561 if (!headers.has('Accept')) {
8562 headers.set('Accept', '*/*');
8566 if (!parsedURL.protocol || !parsedURL.hostname) {
8567 throw new TypeError('Only absolute URLs are supported');
8570 if (!/^https?:$/.test(parsedURL.protocol)) {
8571 throw new TypeError('Only HTTP(S) protocols are supported');
8574 if (request.signal && request.body instanceof stream__WEBPACK_IMPORTED_MODULE_0__.Readable && !streamDestructionSupported) {
8575 throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8');
8578 // HTTP-network-or-cache fetch steps 2.4-2.7
8579 let contentLengthValue = null;
8580 if (request.body == null && /^(POST|PUT)$/i.test(request.method)) {
8581 contentLengthValue = '0';
8583 if (request.body != null) {
8584 const totalBytes = getTotalBytes(request);
8585 if (typeof totalBytes === 'number') {
8586 contentLengthValue = String(totalBytes);
8589 if (contentLengthValue) {
8590 headers.set('Content-Length', contentLengthValue);
8593 // HTTP-network-or-cache fetch step 2.11
8594 if (!headers.has('User-Agent')) {
8595 headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');
8598 // HTTP-network-or-cache fetch step 2.15
8599 if (request.compress && !headers.has('Accept-Encoding')) {
8600 headers.set('Accept-Encoding', 'gzip,deflate');
8603 let agent = request.agent;
8604 if (typeof agent === 'function') {
8605 agent = agent(parsedURL);
8608 if (!headers.has('Connection') && !agent) {
8609 headers.set('Connection', 'close');
8612 // HTTP-network fetch step 4.2
8613 // chunked encoding is handled by Node.js
8615 return Object.assign({}, parsedURL, {
8616 method: request.method,
8617 headers: exportNodeCompatibleHeaders(headers),
8625 * AbortError interface for cancelled requests
8629 * Create AbortError instance
8631 * @param String message Error message for human
8632 * @return AbortError
8634 function AbortError(message) {
8635 Error.call(this, message);
8637 this.type = 'aborted';
8638 this.message = message;
8640 // hide custom error implementation details from end-users
8641 Error.captureStackTrace(this, this.constructor);
8644 AbortError.prototype = Object.create(Error.prototype);
8645 AbortError.prototype.constructor = AbortError;
8646 AbortError.prototype.name = 'AbortError';
8648 // fix an issue where "PassThrough", "resolve" aren't a named export for node <10
8649 const PassThrough$1 = stream__WEBPACK_IMPORTED_MODULE_0__.PassThrough;
8650 const resolve_url = url__WEBPACK_IMPORTED_MODULE_2__.resolve;
8655 * @param Mixed url Absolute url or Request instance
8656 * @param Object opts Fetch options
8659 function fetch(url, opts) {
8661 // allow custom promise
8662 if (!fetch.Promise) {
8663 throw new Error('native promise missing, set fetch.Promise to your favorite alternative');
8666 Body.Promise = fetch.Promise;
8668 // wrap http.request into fetch
8669 return new fetch.Promise(function (resolve, reject) {
8670 // build request object
8671 const request = new Request(url, opts);
8672 const options = getNodeRequestOptions(request);
8674 const send = (options.protocol === 'https:' ? https__WEBPACK_IMPORTED_MODULE_3__ : http__WEBPACK_IMPORTED_MODULE_1__).request;
8675 const signal = request.signal;
8677 let response = null;
8679 const abort = function abort() {
8680 let error = new AbortError('The user aborted a request.');
8682 if (request.body && request.body instanceof stream__WEBPACK_IMPORTED_MODULE_0__.Readable) {
8683 request.body.destroy(error);
8685 if (!response || !response.body) return;
8686 response.body.emit('error', error);
8689 if (signal && signal.aborted) {
8694 const abortAndFinalize = function abortAndFinalize() {
8700 const req = send(options);
8704 signal.addEventListener('abort', abortAndFinalize);
8707 function finalize() {
8709 if (signal) signal.removeEventListener('abort', abortAndFinalize);
8710 clearTimeout(reqTimeout);
8713 if (request.timeout) {
8714 req.once('socket', function (socket) {
8715 reqTimeout = setTimeout(function () {
8716 reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout'));
8718 }, request.timeout);
8722 req.on('error', function (err) {
8723 reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
8727 req.on('response', function (res) {
8728 clearTimeout(reqTimeout);
8730 const headers = createHeadersLenient(res.headers);
8732 // HTTP fetch step 5
8733 if (fetch.isRedirect(res.statusCode)) {
8734 // HTTP fetch step 5.2
8735 const location = headers.get('Location');
8737 // HTTP fetch step 5.3
8738 const locationURL = location === null ? null : resolve_url(request.url, location);
8740 // HTTP fetch step 5.5
8741 switch (request.redirect) {
8743 reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));
8747 // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL.
8748 if (locationURL !== null) {
8749 // handle corrupted header
8751 headers.set('Location', locationURL);
8753 // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request
8759 // HTTP-redirect fetch step 2
8760 if (locationURL === null) {
8764 // HTTP-redirect fetch step 5
8765 if (request.counter >= request.follow) {
8766 reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));
8771 // HTTP-redirect fetch step 6 (counter increment)
8772 // Create a new Request object.
8773 const requestOpts = {
8774 headers: new Headers(request.headers),
8775 follow: request.follow,
8776 counter: request.counter + 1,
8777 agent: request.agent,
8778 compress: request.compress,
8779 method: request.method,
8781 signal: request.signal,
8782 timeout: request.timeout,
8786 // HTTP-redirect fetch step 9
8787 if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
8788 reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
8793 // HTTP-redirect fetch step 11
8794 if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') {
8795 requestOpts.method = 'GET';
8796 requestOpts.body = undefined;
8797 requestOpts.headers.delete('content-length');
8800 // HTTP-redirect fetch step 15
8801 resolve(fetch(new Request(locationURL, requestOpts)));
8808 res.once('end', function () {
8809 if (signal) signal.removeEventListener('abort', abortAndFinalize);
8811 let body = res.pipe(new PassThrough$1());
8813 const response_options = {
8815 status: res.statusCode,
8816 statusText: res.statusMessage,
8819 timeout: request.timeout,
8820 counter: request.counter
8823 // HTTP-network fetch step 12.1.1.3
8824 const codings = headers.get('Content-Encoding');
8826 // HTTP-network fetch step 12.1.1.4: handle content codings
8828 // in following scenarios we ignore compression support
8829 // 1. compression support is disabled
8831 // 3. no Content-Encoding header
8832 // 4. no content response (204)
8833 // 5. content not modified response (304)
8834 if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) {
8835 response = new Response(body, response_options);
8841 // Be less strict when decoding compressed responses, since sometimes
8842 // servers send slightly invalid responses that are still accepted
8843 // by common browsers.
8844 // Always using Z_SYNC_FLUSH is what cURL does.
8845 const zlibOptions = {
8846 flush: zlib__WEBPACK_IMPORTED_MODULE_4__.Z_SYNC_FLUSH,
8847 finishFlush: zlib__WEBPACK_IMPORTED_MODULE_4__.Z_SYNC_FLUSH
8851 if (codings == 'gzip' || codings == 'x-gzip') {
8852 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createGunzip(zlibOptions));
8853 response = new Response(body, response_options);
8859 if (codings == 'deflate' || codings == 'x-deflate') {
8860 // handle the infamous raw deflate response from old servers
8861 // a hack for old IIS and Apache servers
8862 const raw = res.pipe(new PassThrough$1());
8863 raw.once('data', function (chunk) {
8864 // see http://stackoverflow.com/questions/37519828
8865 if ((chunk[0] & 0x0F) === 0x08) {
8866 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createInflate());
8868 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createInflateRaw());
8870 response = new Response(body, response_options);
8877 if (codings == 'br' && typeof zlib__WEBPACK_IMPORTED_MODULE_4__.createBrotliDecompress === 'function') {
8878 body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createBrotliDecompress());
8879 response = new Response(body, response_options);
8884 // otherwise, use response as-is
8885 response = new Response(body, response_options);
8889 writeToStream(req, request);
8893 * Redirect code matching
8895 * @param Number code Status code
8898 fetch.isRedirect = function (code) {
8899 return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
8903 fetch.Promise = global.Promise;
8905 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (fetch);
8911 /***/ ((module) => {
8914 module.exports = require("stream");;
8918 /***/ ((module) => {
8921 module.exports = require("http");;
8925 /***/ ((module) => {
8928 module.exports = require("url");;
8932 /***/ ((module) => {
8935 module.exports = require("https");;
8939 /***/ ((module) => {
8942 module.exports = require("zlib");;
8946 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
8951 const fs = __webpack_require__(42);
8952 const { Readable } = __webpack_require__(44);
8953 const sysPath = __webpack_require__(2);
8954 const { promisify } = __webpack_require__(50);
8955 const picomatch = __webpack_require__(51);
8957 const readdir = promisify(fs.readdir);
8958 const stat = promisify(fs.stat);
8959 const lstat = promisify(fs.lstat);
8960 const realpath = promisify(fs.realpath);
8963 * @typedef {Object} EntryInfo
8964 * @property {String} path
8965 * @property {String} fullPath
8966 * @property {fs.Stats=} stats
8967 * @property {fs.Dirent=} dirent
8968 * @property {String} basename
8972 const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP']);
8973 const FILE_TYPE = 'files';
8974 const DIR_TYPE = 'directories';
8975 const FILE_DIR_TYPE = 'files_directories';
8976 const EVERYTHING_TYPE = 'all';
8977 const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];
8979 const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code);
8981 const normalizeFilter = filter => {
8982 if (filter === undefined) return;
8983 if (typeof filter === 'function') return filter;
8985 if (typeof filter === 'string') {
8986 const glob = picomatch(filter.trim());
8987 return entry => glob(entry.basename);
8990 if (Array.isArray(filter)) {
8991 const positive = [];
8992 const negative = [];
8993 for (const item of filter) {
8994 const trimmed = item.trim();
8995 if (trimmed.charAt(0) === BANG) {
8996 negative.push(picomatch(trimmed.slice(1)));
8998 positive.push(picomatch(trimmed));
9002 if (negative.length > 0) {
9003 if (positive.length > 0) {
9005 positive.some(f => f(entry.basename)) && !negative.some(f => f(entry.basename));
9007 return entry => !negative.some(f => f(entry.basename));
9009 return entry => positive.some(f => f(entry.basename));
9013 class ReaddirpStream extends Readable {
9014 static get defaultOptions() {
9017 /* eslint-disable no-unused-vars */
9018 fileFilter: (path) => true,
9019 directoryFilter: (path) => true,
9020 /* eslint-enable no-unused-vars */
9028 constructor(options = {}) {
9032 highWaterMark: options.highWaterMark || 4096
9034 const opts = { ...ReaddirpStream.defaultOptions, ...options };
9035 const { root, type } = opts;
9037 this._fileFilter = normalizeFilter(opts.fileFilter);
9038 this._directoryFilter = normalizeFilter(opts.directoryFilter);
9040 const statMethod = opts.lstat ? lstat : stat;
9041 // Use bigint stats if it's windows and stat() supports options (node 10+).
9042 if (process.platform === 'win32' && stat.length === 3) {
9043 this._stat = path => statMethod(path, { bigint: true });
9045 this._stat = statMethod;
9048 this._maxDepth = opts.depth;
9049 this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
9050 this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
9051 this._wantsEverything = type === EVERYTHING_TYPE;
9052 this._root = sysPath.resolve(root);
9053 this._isDirent = ('Dirent' in fs) && !opts.alwaysStat;
9054 this._statsProp = this._isDirent ? 'dirent' : 'stats';
9055 this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent };
9057 // Launch stream with one parent, the root dir.
9058 this.parents = [this._exploreDir(root, 1)];
9059 this.reading = false;
9060 this.parent = undefined;
9063 async _read(batch) {
9064 if (this.reading) return;
9065 this.reading = true;
9068 while (!this.destroyed && batch > 0) {
9069 const { path, depth, files = [] } = this.parent || {};
9071 if (files.length > 0) {
9072 const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path));
9073 for (const entry of await Promise.all(slice)) {
9074 if (this.destroyed) return;
9076 const entryType = await this._getEntryType(entry);
9077 if (entryType === 'directory' && this._directoryFilter(entry)) {
9078 if (depth <= this._maxDepth) {
9079 this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
9082 if (this._wantsDir) {
9086 } else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) {
9087 if (this._wantsFile) {
9094 const parent = this.parents.pop();
9099 this.parent = await parent;
9100 if (this.destroyed) return;
9104 this.destroy(error);
9106 this.reading = false;
9110 async _exploreDir(path, depth) {
9113 files = await readdir(path, this._rdOptions);
9115 this._onError(error);
9117 return {files, depth, path};
9120 async _formatEntry(dirent, path) {
9123 const basename = this._isDirent ? dirent.name : dirent;
9124 const fullPath = sysPath.resolve(sysPath.join(path, basename));
9125 entry = {path: sysPath.relative(this._root, fullPath), fullPath, basename};
9126 entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
9134 if (isNormalFlowError(err) && !this.destroyed) {
9135 this.emit('warn', err);
9141 async _getEntryType(entry) {
9142 // entry may be undefined, because a warning or an error were emitted
9143 // and the statsProp is undefined
9144 const stats = entry && entry[this._statsProp];
9148 if (stats.isFile()) {
9151 if (stats.isDirectory()) {
9154 if (stats && stats.isSymbolicLink()) {
9156 const entryRealPath = await realpath(entry.fullPath);
9157 const entryRealPathStats = await lstat(entryRealPath);
9158 if (entryRealPathStats.isFile()) {
9161 if (entryRealPathStats.isDirectory()) {
9165 this._onError(error);
9170 _includeAsFile(entry) {
9171 const stats = entry && entry[this._statsProp];
9173 return stats && this._wantsEverything && !stats.isDirectory();
9178 * @typedef {Object} ReaddirpArguments
9179 * @property {Function=} fileFilter
9180 * @property {Function=} directoryFilter
9181 * @property {String=} type
9182 * @property {Number=} depth
9183 * @property {String=} root
9184 * @property {Boolean=} lstat
9185 * @property {Boolean=} bigint
9189 * Main function which ends up calling readdirRec and reads all files and directories in given root recursively.
9190 * @param {String} root Root directory
9191 * @param {ReaddirpArguments=} options Options to specify root (start directory), filters and recursion depth
9193 const readdirp = (root, options = {}) => {
9194 let type = options.entryType || options.type;
9195 if (type === 'both') type = FILE_DIR_TYPE; // backwards-compatibility
9196 if (type) options.type = type;
9198 throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)');
9199 } else if (typeof root !== 'string') {
9200 throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)');
9201 } else if (type && !ALL_TYPES.includes(type)) {
9202 throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`);
9205 options.root = root;
9206 return new ReaddirpStream(options);
9209 const readdirpPromise = (root, options = {}) => {
9210 return new Promise((resolve, reject) => {
9212 readdirp(root, options)
9213 .on('data', entry => files.push(entry))
9214 .on('end', () => resolve(files))
9215 .on('error', error => reject(error));
9219 readdirp.promise = readdirpPromise;
9220 readdirp.ReaddirpStream = ReaddirpStream;
9221 readdirp.default = readdirp;
9223 module.exports = readdirp;
9228 /***/ ((module) => {
9231 module.exports = require("util");;
9235 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
9240 module.exports = __webpack_require__(52);
9245 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
9250 const path = __webpack_require__(2);
9251 const scan = __webpack_require__(53);
9252 const parse = __webpack_require__(56);
9253 const utils = __webpack_require__(54);
9254 const constants = __webpack_require__(55);
9255 const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
9258 * Creates a matcher function from one or more glob patterns. The
9259 * returned function takes a string to match as its first argument,
9260 * and returns true if the string is a match. The returned matcher
9261 * function also takes a boolean as the second argument that, when true,
9262 * returns an object with additional information.
9265 * const picomatch = require('picomatch');
9266 * // picomatch(glob[, options]);
9268 * const isMatch = picomatch('*.!(*a)');
9269 * console.log(isMatch('a.a')); //=> false
9270 * console.log(isMatch('a.b')); //=> true
9273 * @param {String|Array} `globs` One or more glob patterns.
9274 * @param {Object=} `options`
9275 * @return {Function=} Returns a matcher function.
9279 const picomatch = (glob, options, returnState = false) => {
9280 if (Array.isArray(glob)) {
9281 const fns = glob.map(input => picomatch(input, options, returnState));
9282 const arrayMatcher = str => {
9283 for (const isMatch of fns) {
9284 const state = isMatch(str);
9285 if (state) return state;
9289 return arrayMatcher;
9292 const isState = isObject(glob) && glob.tokens && glob.input;
9294 if (glob === '' || (typeof glob !== 'string' && !isState)) {
9295 throw new TypeError('Expected pattern to be a non-empty string');
9298 const opts = options || {};
9299 const posix = utils.isWindows(options);
9300 const regex = isState
9301 ? picomatch.compileRe(glob, options)
9302 : picomatch.makeRe(glob, options, false, true);
9304 const state = regex.state;
9307 let isIgnored = () => false;
9309 const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
9310 isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
9313 const matcher = (input, returnObject = false) => {
9314 const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
9315 const result = { glob, state, regex, posix, input, output, match, isMatch };
9317 if (typeof opts.onResult === 'function') {
9318 opts.onResult(result);
9321 if (isMatch === false) {
9322 result.isMatch = false;
9323 return returnObject ? result : false;
9326 if (isIgnored(input)) {
9327 if (typeof opts.onIgnore === 'function') {
9328 opts.onIgnore(result);
9330 result.isMatch = false;
9331 return returnObject ? result : false;
9334 if (typeof opts.onMatch === 'function') {
9335 opts.onMatch(result);
9337 return returnObject ? result : true;
9341 matcher.state = state;
9348 * Test `input` with the given `regex`. This is used by the main
9349 * `picomatch()` function to test the input string.
9352 * const picomatch = require('picomatch');
9353 * // picomatch.test(input, regex[, options]);
9355 * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
9356 * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
9358 * @param {String} `input` String to test.
9359 * @param {RegExp} `regex`
9360 * @return {Object} Returns an object with matching info.
9364 picomatch.test = (input, regex, options, { glob, posix } = {}) => {
9365 if (typeof input !== 'string') {
9366 throw new TypeError('Expected input to be a string');
9370 return { isMatch: false, output: '' };
9373 const opts = options || {};
9374 const format = opts.format || (posix ? utils.toPosixSlashes : null);
9375 let match = input === glob;
9376 let output = (match && format) ? format(input) : input;
9378 if (match === false) {
9379 output = format ? format(input) : input;
9380 match = output === glob;
9383 if (match === false || opts.capture === true) {
9384 if (opts.matchBase === true || opts.basename === true) {
9385 match = picomatch.matchBase(input, regex, options, posix);
9387 match = regex.exec(output);
9391 return { isMatch: Boolean(match), match, output };
9395 * Match the basename of a filepath.
9398 * const picomatch = require('picomatch');
9399 * // picomatch.matchBase(input, glob[, options]);
9400 * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
9402 * @param {String} `input` String to test.
9403 * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
9408 picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
9409 const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
9410 return regex.test(path.basename(input));
9414 * Returns true if **any** of the given glob `patterns` match the specified `string`.
9417 * const picomatch = require('picomatch');
9418 * // picomatch.isMatch(string, patterns[, options]);
9420 * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
9421 * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
9423 * @param {String|Array} str The string to test.
9424 * @param {String|Array} patterns One or more glob patterns to use for matching.
9425 * @param {Object} [options] See available [options](#options).
9426 * @return {Boolean} Returns true if any patterns match `str`
9430 picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
9433 * Parse a glob pattern to create the source string for a regular
9437 * const picomatch = require('picomatch');
9438 * const result = picomatch.parse(pattern[, options]);
9440 * @param {String} `pattern`
9441 * @param {Object} `options`
9442 * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
9446 picomatch.parse = (pattern, options) => {
9447 if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
9448 return parse(pattern, { ...options, fastpaths: false });
9452 * Scan a glob pattern to separate the pattern into segments.
9455 * const picomatch = require('picomatch');
9456 * // picomatch.scan(input[, options]);
9458 * const result = picomatch.scan('!./foo/*.js');
9459 * console.log(result);
9461 * input: '!./foo/*.js',
9469 * isGlobstar: false,
9472 * @param {String} `input` Glob pattern to scan.
9473 * @param {Object} `options`
9474 * @return {Object} Returns an object with
9478 picomatch.scan = (input, options) => scan(input, options);
9481 * Create a regular expression from a parsed glob pattern.
9484 * const picomatch = require('picomatch');
9485 * const state = picomatch.parse('*.js');
9486 * // picomatch.compileRe(state[, options]);
9488 * console.log(picomatch.compileRe(state));
9489 * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
9491 * @param {String} `state` The object returned from the `.parse` method.
9492 * @param {Object} `options`
9493 * @return {RegExp} Returns a regex created from the given pattern.
9497 picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => {
9498 if (returnOutput === true) {
9499 return parsed.output;
9502 const opts = options || {};
9503 const prepend = opts.contains ? '' : '^';
9504 const append = opts.contains ? '' : '$';
9506 let source = `${prepend}(?:${parsed.output})${append}`;
9507 if (parsed && parsed.negated === true) {
9508 source = `^(?!${source}).*$`;
9511 const regex = picomatch.toRegex(source, options);
9512 if (returnState === true) {
9513 regex.state = parsed;
9519 picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => {
9520 if (!input || typeof input !== 'string') {
9521 throw new TypeError('Expected a non-empty string');
9524 const opts = options || {};
9525 let parsed = { negated: false, fastpaths: true };
9529 if (input.startsWith('./')) {
9530 input = input.slice(2);
9531 prefix = parsed.prefix = './';
9534 if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
9535 output = parse.fastpaths(input, options);
9538 if (output === undefined) {
9539 parsed = parse(input, options);
9540 parsed.prefix = prefix + (parsed.prefix || '');
9542 parsed.output = output;
9545 return picomatch.compileRe(parsed, options, returnOutput, returnState);
9549 * Create a regular expression from the given regex source string.
9552 * const picomatch = require('picomatch');
9553 * // picomatch.toRegex(source[, options]);
9555 * const { output } = picomatch.parse('*.js');
9556 * console.log(picomatch.toRegex(output));
9557 * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
9559 * @param {String} `source` Regular expression source string.
9560 * @param {Object} `options`
9565 picomatch.toRegex = (source, options) => {
9567 const opts = options || {};
9568 return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
9570 if (options && options.debug === true) throw err;
9576 * Picomatch constants.
9580 picomatch.constants = constants;
9583 * Expose "picomatch"
9586 module.exports = picomatch;
9591 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
9596 const utils = __webpack_require__(54);
9598 CHAR_ASTERISK, /* * */
9600 CHAR_BACKWARD_SLASH, /* \ */
9603 CHAR_EXCLAMATION_MARK, /* ! */
9604 CHAR_FORWARD_SLASH, /* / */
9605 CHAR_LEFT_CURLY_BRACE, /* { */
9606 CHAR_LEFT_PARENTHESES, /* ( */
9607 CHAR_LEFT_SQUARE_BRACKET, /* [ */
9609 CHAR_QUESTION_MARK, /* ? */
9610 CHAR_RIGHT_CURLY_BRACE, /* } */
9611 CHAR_RIGHT_PARENTHESES, /* ) */
9612 CHAR_RIGHT_SQUARE_BRACKET /* ] */
9613 } = __webpack_require__(55);
9615 const isPathSeparator = code => {
9616 return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
9619 const depth = token => {
9620 if (token.isPrefix !== true) {
9621 token.depth = token.isGlobstar ? Infinity : 1;
9626 * Quickly scans a glob pattern and returns an object with a handful of
9627 * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
9628 * `glob` (the actual pattern), and `negated` (true if the path starts with `!`).
9631 * const pm = require('picomatch');
9632 * console.log(pm.scan('foo/bar/*.js'));
9633 * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
9635 * @param {String} `str`
9636 * @param {Object} `options`
9637 * @return {Object} Returns an object with tokens and regex source string.
9641 const scan = (input, options) => {
9642 const opts = options || {};
9644 const length = input.length - 1;
9645 const scanToEnd = opts.parts === true || opts.scanToEnd === true;
9654 let isBrace = false;
9655 let isBracket = false;
9657 let isExtglob = false;
9658 let isGlobstar = false;
9659 let braceEscaped = false;
9660 let backslashes = false;
9661 let negated = false;
9662 let finished = false;
9666 let token = { value: '', depth: 0, isGlob: false };
9668 const eos = () => index >= length;
9669 const peek = () => str.charCodeAt(index + 1);
9670 const advance = () => {
9672 return str.charCodeAt(++index);
9675 while (index < length) {
9679 if (code === CHAR_BACKWARD_SLASH) {
9680 backslashes = token.backslashes = true;
9683 if (code === CHAR_LEFT_CURLY_BRACE) {
9684 braceEscaped = true;
9689 if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
9692 while (eos() !== true && (code = advance())) {
9693 if (code === CHAR_BACKWARD_SLASH) {
9694 backslashes = token.backslashes = true;
9699 if (code === CHAR_LEFT_CURLY_BRACE) {
9704 if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
9705 isBrace = token.isBrace = true;
9706 isGlob = token.isGlob = true;
9709 if (scanToEnd === true) {
9716 if (braceEscaped !== true && code === CHAR_COMMA) {
9717 isBrace = token.isBrace = true;
9718 isGlob = token.isGlob = true;
9721 if (scanToEnd === true) {
9728 if (code === CHAR_RIGHT_CURLY_BRACE) {
9732 braceEscaped = false;
9733 isBrace = token.isBrace = true;
9740 if (scanToEnd === true) {
9747 if (code === CHAR_FORWARD_SLASH) {
9748 slashes.push(index);
9750 token = { value: '', depth: 0, isGlob: false };
9752 if (finished === true) continue;
9753 if (prev === CHAR_DOT && index === (start + 1)) {
9758 lastIndex = index + 1;
9762 if (opts.noext !== true) {
9763 const isExtglobChar = code === CHAR_PLUS
9765 || code === CHAR_ASTERISK
9766 || code === CHAR_QUESTION_MARK
9767 || code === CHAR_EXCLAMATION_MARK;
9769 if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
9770 isGlob = token.isGlob = true;
9771 isExtglob = token.isExtglob = true;
9774 if (scanToEnd === true) {
9775 while (eos() !== true && (code = advance())) {
9776 if (code === CHAR_BACKWARD_SLASH) {
9777 backslashes = token.backslashes = true;
9782 if (code === CHAR_RIGHT_PARENTHESES) {
9783 isGlob = token.isGlob = true;
9794 if (code === CHAR_ASTERISK) {
9795 if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
9796 isGlob = token.isGlob = true;
9799 if (scanToEnd === true) {
9805 if (code === CHAR_QUESTION_MARK) {
9806 isGlob = token.isGlob = true;
9809 if (scanToEnd === true) {
9815 if (code === CHAR_LEFT_SQUARE_BRACKET) {
9816 while (eos() !== true && (next = advance())) {
9817 if (next === CHAR_BACKWARD_SLASH) {
9818 backslashes = token.backslashes = true;
9823 if (next === CHAR_RIGHT_SQUARE_BRACKET) {
9824 isBracket = token.isBracket = true;
9825 isGlob = token.isGlob = true;
9828 if (scanToEnd === true) {
9836 if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
9837 negated = token.negated = true;
9842 if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
9843 isGlob = token.isGlob = true;
9845 if (scanToEnd === true) {
9846 while (eos() !== true && (code = advance())) {
9847 if (code === CHAR_LEFT_PARENTHESES) {
9848 backslashes = token.backslashes = true;
9853 if (code === CHAR_RIGHT_PARENTHESES) {
9863 if (isGlob === true) {
9866 if (scanToEnd === true) {
9874 if (opts.noext === true) {
9884 prefix = str.slice(0, start);
9885 str = str.slice(start);
9889 if (base && isGlob === true && lastIndex > 0) {
9890 base = str.slice(0, lastIndex);
9891 glob = str.slice(lastIndex);
9892 } else if (isGlob === true) {
9899 if (base && base !== '' && base !== '/' && base !== str) {
9900 if (isPathSeparator(base.charCodeAt(base.length - 1))) {
9901 base = base.slice(0, -1);
9905 if (opts.unescape === true) {
9906 if (glob) glob = utils.removeBackslashes(glob);
9908 if (base && backslashes === true) {
9909 base = utils.removeBackslashes(base);
9927 if (opts.tokens === true) {
9929 if (!isPathSeparator(code)) {
9932 state.tokens = tokens;
9935 if (opts.parts === true || opts.tokens === true) {
9938 for (let idx = 0; idx < slashes.length; idx++) {
9939 const n = prevIndex ? prevIndex + 1 : start;
9940 const i = slashes[idx];
9941 const value = input.slice(n, i);
9943 if (idx === 0 && start !== 0) {
9944 tokens[idx].isPrefix = true;
9945 tokens[idx].value = prefix;
9947 tokens[idx].value = value;
9950 state.maxDepth += tokens[idx].depth;
9952 if (idx !== 0 || value !== '') {
9958 if (prevIndex && prevIndex + 1 < input.length) {
9959 const value = input.slice(prevIndex + 1);
9963 tokens[tokens.length - 1].value = value;
9964 depth(tokens[tokens.length - 1]);
9965 state.maxDepth += tokens[tokens.length - 1].depth;
9969 state.slashes = slashes;
9970 state.parts = parts;
9976 module.exports = scan;
9981 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9986 const path = __webpack_require__(2);
9987 const win32 = process.platform === 'win32';
9990 REGEX_REMOVE_BACKSLASH,
9991 REGEX_SPECIAL_CHARS,
9992 REGEX_SPECIAL_CHARS_GLOBAL
9993 } = __webpack_require__(55);
9995 exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
9996 exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
9997 exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
9998 exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
9999 exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
10001 exports.removeBackslashes = str => {
10002 return str.replace(REGEX_REMOVE_BACKSLASH, match => {
10003 return match === '\\' ? '' : match;
10007 exports.supportsLookbehinds = () => {
10008 const segs = process.version.slice(1).split('.').map(Number);
10009 if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
10015 exports.isWindows = options => {
10016 if (options && typeof options.windows === 'boolean') {
10017 return options.windows;
10019 return win32 === true || path.sep === '\\';
10022 exports.escapeLast = (input, char, lastIdx) => {
10023 const idx = input.lastIndexOf(char, lastIdx);
10024 if (idx === -1) return input;
10025 if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
10026 return `${input.slice(0, idx)}\\${input.slice(idx)}`;
10029 exports.removePrefix = (input, state = {}) => {
10030 let output = input;
10031 if (output.startsWith('./')) {
10032 output = output.slice(2);
10033 state.prefix = './';
10038 exports.wrapOutput = (input, state = {}, options = {}) => {
10039 const prepend = options.contains ? '' : '^';
10040 const append = options.contains ? '' : '$';
10042 let output = `${prepend}(?:${input})${append}`;
10043 if (state.negated === true) {
10044 output = `(?:^(?!${output}).*$)`;
10052 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
10057 const path = __webpack_require__(2);
10058 const WIN_SLASH = '\\\\/';
10059 const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
10065 const DOT_LITERAL = '\\.';
10066 const PLUS_LITERAL = '\\+';
10067 const QMARK_LITERAL = '\\?';
10068 const SLASH_LITERAL = '\\/';
10069 const ONE_CHAR = '(?=.)';
10070 const QMARK = '[^/]';
10071 const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
10072 const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
10073 const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
10074 const NO_DOT = `(?!${DOT_LITERAL})`;
10075 const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
10076 const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
10077 const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
10078 const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
10079 const STAR = `${QMARK}*?`;
10081 const POSIX_CHARS = {
10100 * Windows glob regex
10103 const WINDOWS_CHARS = {
10106 SLASH_LITERAL: `[${WIN_SLASH}]`,
10107 QMARK: WIN_NO_SLASH,
10108 STAR: `${WIN_NO_SLASH}*?`,
10109 DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
10110 NO_DOT: `(?!${DOT_LITERAL})`,
10111 NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
10112 NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
10113 NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
10114 QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
10115 START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
10116 END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
10120 * POSIX Bracket Regex
10123 const POSIX_REGEX_SOURCE = {
10124 alnum: 'a-zA-Z0-9',
10126 ascii: '\\x00-\\x7F',
10128 cntrl: '\\x00-\\x1F\\x7F',
10130 graph: '\\x21-\\x7E',
10132 print: '\\x20-\\x7E ',
10133 punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
10134 space: ' \\t\\r\\n\\v\\f',
10136 word: 'A-Za-z0-9_',
10137 xdigit: 'A-Fa-f0-9'
10141 MAX_LENGTH: 1024 * 64,
10142 POSIX_REGEX_SOURCE,
10144 // regular expressions
10145 REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
10146 REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
10147 REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
10148 REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
10149 REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
10150 REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
10152 // Replace globs with equivalent patterns to reduce parsing time.
10160 CHAR_0: 48, /* 0 */
10161 CHAR_9: 57, /* 9 */
10164 CHAR_UPPERCASE_A: 65, /* A */
10165 CHAR_LOWERCASE_A: 97, /* a */
10166 CHAR_UPPERCASE_Z: 90, /* Z */
10167 CHAR_LOWERCASE_Z: 122, /* z */
10169 CHAR_LEFT_PARENTHESES: 40, /* ( */
10170 CHAR_RIGHT_PARENTHESES: 41, /* ) */
10172 CHAR_ASTERISK: 42, /* * */
10174 // Non-alphabetic chars.
10175 CHAR_AMPERSAND: 38, /* & */
10176 CHAR_AT: 64, /* @ */
10177 CHAR_BACKWARD_SLASH: 92, /* \ */
10178 CHAR_CARRIAGE_RETURN: 13, /* \r */
10179 CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
10180 CHAR_COLON: 58, /* : */
10181 CHAR_COMMA: 44, /* , */
10182 CHAR_DOT: 46, /* . */
10183 CHAR_DOUBLE_QUOTE: 34, /* " */
10184 CHAR_EQUAL: 61, /* = */
10185 CHAR_EXCLAMATION_MARK: 33, /* ! */
10186 CHAR_FORM_FEED: 12, /* \f */
10187 CHAR_FORWARD_SLASH: 47, /* / */
10188 CHAR_GRAVE_ACCENT: 96, /* ` */
10189 CHAR_HASH: 35, /* # */
10190 CHAR_HYPHEN_MINUS: 45, /* - */
10191 CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
10192 CHAR_LEFT_CURLY_BRACE: 123, /* { */
10193 CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
10194 CHAR_LINE_FEED: 10, /* \n */
10195 CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
10196 CHAR_PERCENT: 37, /* % */
10197 CHAR_PLUS: 43, /* + */
10198 CHAR_QUESTION_MARK: 63, /* ? */
10199 CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
10200 CHAR_RIGHT_CURLY_BRACE: 125, /* } */
10201 CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
10202 CHAR_SEMICOLON: 59, /* ; */
10203 CHAR_SINGLE_QUOTE: 39, /* ' */
10204 CHAR_SPACE: 32, /* */
10205 CHAR_TAB: 9, /* \t */
10206 CHAR_UNDERSCORE: 95, /* _ */
10207 CHAR_VERTICAL_LINE: 124, /* | */
10208 CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
10213 * Create EXTGLOB_CHARS
10216 extglobChars(chars) {
10218 '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
10219 '?': { type: 'qmark', open: '(?:', close: ')?' },
10220 '+': { type: 'plus', open: '(?:', close: ')+' },
10221 '*': { type: 'star', open: '(?:', close: ')*' },
10222 '@': { type: 'at', open: '(?:', close: ')' }
10227 * Create GLOB_CHARS
10231 return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
10238 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
10243 const constants = __webpack_require__(55);
10244 const utils = __webpack_require__(54);
10252 POSIX_REGEX_SOURCE,
10253 REGEX_NON_SPECIAL_CHARS,
10254 REGEX_SPECIAL_CHARS_BACKREF,
10262 const expandRange = (args, options) => {
10263 if (typeof options.expandRange === 'function') {
10264 return options.expandRange(...args, options);
10268 const value = `[${args.join('-')}]`;
10271 /* eslint-disable-next-line no-new */
10274 return args.map(v => utils.escapeRegex(v)).join('..');
10281 * Create the message for a syntax error
10284 const syntaxError = (type, char) => {
10285 return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
10289 * Parse the given input string.
10290 * @param {String} input
10291 * @param {Object} options
10295 const parse = (input, options) => {
10296 if (typeof input !== 'string') {
10297 throw new TypeError('Expected a string');
10300 input = REPLACEMENTS[input] || input;
10302 const opts = { ...options };
10303 const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
10305 let len = input.length;
10307 throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
10310 const bos = { type: 'bos', value: '', output: opts.prepend || '' };
10311 const tokens = [bos];
10313 const capture = opts.capture ? '' : '?:';
10314 const win32 = utils.isWindows(options);
10316 // create constants based on platform, for windows or posix
10317 const PLATFORM_CHARS = constants.globChars(win32);
10318 const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
10333 } = PLATFORM_CHARS;
10335 const globstar = (opts) => {
10336 return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
10339 const nodot = opts.dot ? '' : NO_DOT;
10340 const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
10341 let star = opts.bash === true ? globstar(opts) : STAR;
10343 if (opts.capture) {
10344 star = `(${star})`;
10347 // minimatch options support
10348 if (typeof opts.noext === 'boolean') {
10349 opts.noextglob = opts.noext;
10356 dot: opts.dot === true,
10370 input = utils.removePrefix(input, state);
10371 len = input.length;
10373 const extglobs = [];
10380 * Tokenizing helpers
10383 const eos = () => state.index === len - 1;
10384 const peek = state.peek = (n = 1) => input[state.index + n];
10385 const advance = state.advance = () => input[++state.index];
10386 const remaining = () => input.slice(state.index + 1);
10387 const consume = (value = '', num = 0) => {
10388 state.consumed += value;
10389 state.index += num;
10391 const append = token => {
10392 state.output += token.output != null ? token.output : token.value;
10393 consume(token.value);
10396 const negate = () => {
10399 while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
10405 if (count % 2 === 0) {
10409 state.negated = true;
10414 const increment = type => {
10419 const decrement = type => {
10425 * Push tokens onto the tokens array. This helper speeds up
10426 * tokenizing by 1) helping us avoid backtracking as much as possible,
10427 * and 2) helping us avoid creating extra tokens when consecutive
10428 * characters are plain text. This improves performance and simplifies
10432 const push = tok => {
10433 if (prev.type === 'globstar') {
10434 const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
10435 const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
10437 if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
10438 state.output = state.output.slice(0, -prev.output.length);
10439 prev.type = 'star';
10441 prev.output = star;
10442 state.output += prev.output;
10446 if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) {
10447 extglobs[extglobs.length - 1].inner += tok.value;
10450 if (tok.value || tok.output) append(tok);
10451 if (prev && prev.type === 'text' && tok.type === 'text') {
10452 prev.value += tok.value;
10453 prev.output = (prev.output || '') + tok.value;
10462 const extglobOpen = (type, value) => {
10463 const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
10466 token.parens = state.parens;
10467 token.output = state.output;
10468 const output = (opts.capture ? '(' : '') + token.open;
10470 increment('parens');
10471 push({ type, value, output: state.output ? '' : ONE_CHAR });
10472 push({ type: 'paren', extglob: true, value: advance(), output });
10473 extglobs.push(token);
10476 const extglobClose = token => {
10477 let output = token.close + (opts.capture ? ')' : '');
10479 if (token.type === 'negate') {
10480 let extglobStar = star;
10482 if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
10483 extglobStar = globstar(opts);
10486 if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
10487 output = token.close = `)$))${extglobStar}`;
10490 if (token.prev.type === 'bos' && eos()) {
10491 state.negatedExtglob = true;
10495 push({ type: 'paren', extglob: true, value, output });
10496 decrement('parens');
10503 if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
10504 let backslashes = false;
10506 let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
10507 if (first === '\\') {
10508 backslashes = true;
10512 if (first === '?') {
10514 return esc + first + (rest ? QMARK.repeat(rest.length) : '');
10517 return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
10519 return QMARK.repeat(chars.length);
10522 if (first === '.') {
10523 return DOT_LITERAL.repeat(chars.length);
10526 if (first === '*') {
10528 return esc + first + (rest ? star : '');
10532 return esc ? m : `\\${m}`;
10535 if (backslashes === true) {
10536 if (opts.unescape === true) {
10537 output = output.replace(/\\/g, '');
10539 output = output.replace(/\\+/g, m => {
10540 return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
10545 if (output === input && opts.contains === true) {
10546 state.output = input;
10550 state.output = utils.wrapOutput(output, state, options);
10555 * Tokenize input until we reach end-of-string
10561 if (value === '\u0000') {
10566 * Escaped characters
10569 if (value === '\\') {
10570 const next = peek();
10572 if (next === '/' && opts.bash !== true) {
10576 if (next === '.' || next === ';') {
10582 push({ type: 'text', value });
10586 // collapse slashes to reduce potential for exploits
10587 const match = /^\\+/.exec(remaining());
10590 if (match && match[0].length > 2) {
10591 slashes = match[0].length;
10592 state.index += slashes;
10593 if (slashes % 2 !== 0) {
10598 if (opts.unescape === true) {
10599 value = advance() || '';
10601 value += advance() || '';
10604 if (state.brackets === 0) {
10605 push({ type: 'text', value });
10611 * If we're inside a regex character class, continue
10612 * until we reach the closing bracket.
10615 if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
10616 if (opts.posix !== false && value === ':') {
10617 const inner = prev.value.slice(1);
10618 if (inner.includes('[')) {
10621 if (inner.includes(':')) {
10622 const idx = prev.value.lastIndexOf('[');
10623 const pre = prev.value.slice(0, idx);
10624 const rest = prev.value.slice(idx + 2);
10625 const posix = POSIX_REGEX_SOURCE[rest];
10627 prev.value = pre + posix;
10628 state.backtrack = true;
10631 if (!bos.output && tokens.indexOf(prev) === 1) {
10632 bos.output = ONE_CHAR;
10640 if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
10641 value = `\\${value}`;
10644 if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
10645 value = `\\${value}`;
10648 if (opts.posix === true && value === '!' && prev.value === '[') {
10652 prev.value += value;
10658 * If we're inside a quoted string, continue
10659 * until we reach the closing double quote.
10662 if (state.quotes === 1 && value !== '"') {
10663 value = utils.escapeRegex(value);
10664 prev.value += value;
10673 if (value === '"') {
10674 state.quotes = state.quotes === 1 ? 0 : 1;
10675 if (opts.keepQuotes === true) {
10676 push({ type: 'text', value });
10685 if (value === '(') {
10686 increment('parens');
10687 push({ type: 'paren', value });
10691 if (value === ')') {
10692 if (state.parens === 0 && opts.strictBrackets === true) {
10693 throw new SyntaxError(syntaxError('opening', '('));
10696 const extglob = extglobs[extglobs.length - 1];
10697 if (extglob && state.parens === extglob.parens + 1) {
10698 extglobClose(extglobs.pop());
10702 push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
10703 decrement('parens');
10711 if (value === '[') {
10712 if (opts.nobracket === true || !remaining().includes(']')) {
10713 if (opts.nobracket !== true && opts.strictBrackets === true) {
10714 throw new SyntaxError(syntaxError('closing', ']'));
10717 value = `\\${value}`;
10719 increment('brackets');
10722 push({ type: 'bracket', value });
10726 if (value === ']') {
10727 if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
10728 push({ type: 'text', value, output: `\\${value}` });
10732 if (state.brackets === 0) {
10733 if (opts.strictBrackets === true) {
10734 throw new SyntaxError(syntaxError('opening', '['));
10737 push({ type: 'text', value, output: `\\${value}` });
10741 decrement('brackets');
10743 const prevValue = prev.value.slice(1);
10744 if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
10745 value = `/${value}`;
10748 prev.value += value;
10751 // when literal brackets are explicitly disabled
10752 // assume we should match with a regex character class
10753 if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
10757 const escaped = utils.escapeRegex(prev.value);
10758 state.output = state.output.slice(0, -prev.value.length);
10760 // when literal brackets are explicitly enabled
10761 // assume we should escape the brackets to match literal characters
10762 if (opts.literalBrackets === true) {
10763 state.output += escaped;
10764 prev.value = escaped;
10768 // when the user specifies nothing, try to match both
10769 prev.value = `(${capture}${escaped}|${prev.value})`;
10770 state.output += prev.value;
10778 if (value === '{' && opts.nobrace !== true) {
10779 increment('braces');
10785 outputIndex: state.output.length,
10786 tokensIndex: state.tokens.length
10794 if (value === '}') {
10795 const brace = braces[braces.length - 1];
10797 if (opts.nobrace === true || !brace) {
10798 push({ type: 'text', value, output: value });
10804 if (brace.dots === true) {
10805 const arr = tokens.slice();
10808 for (let i = arr.length - 1; i >= 0; i--) {
10810 if (arr[i].type === 'brace') {
10813 if (arr[i].type !== 'dots') {
10814 range.unshift(arr[i].value);
10818 output = expandRange(range, opts);
10819 state.backtrack = true;
10822 if (brace.comma !== true && brace.dots !== true) {
10823 const out = state.output.slice(0, brace.outputIndex);
10824 const toks = state.tokens.slice(brace.tokensIndex);
10825 brace.value = brace.output = '\\{';
10826 value = output = '\\}';
10827 state.output = out;
10828 for (const t of toks) {
10829 state.output += (t.output || t.value);
10833 push({ type: 'brace', value, output });
10834 decrement('braces');
10843 if (value === '|') {
10844 if (extglobs.length > 0) {
10845 extglobs[extglobs.length - 1].conditions++;
10847 push({ type: 'text', value });
10855 if (value === ',') {
10856 let output = value;
10858 const brace = braces[braces.length - 1];
10859 if (brace && stack[stack.length - 1] === 'braces') {
10860 brace.comma = true;
10864 push({ type: 'comma', value, output });
10872 if (value === '/') {
10873 // if the beginning of the glob is "./", advance the start
10874 // to the current index, and don't add the "./" characters
10875 // to the state. This greatly simplifies lookbehinds when
10876 // checking for BOS characters like "!" and "." (not "./")
10877 if (prev.type === 'dot' && state.index === state.start + 1) {
10878 state.start = state.index + 1;
10879 state.consumed = '';
10882 prev = bos; // reset "prev" to the first token
10886 push({ type: 'slash', value, output: SLASH_LITERAL });
10894 if (value === '.') {
10895 if (state.braces > 0 && prev.type === 'dot') {
10896 if (prev.value === '.') prev.output = DOT_LITERAL;
10897 const brace = braces[braces.length - 1];
10898 prev.type = 'dots';
10899 prev.output += value;
10900 prev.value += value;
10905 if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
10906 push({ type: 'text', value, output: DOT_LITERAL });
10910 push({ type: 'dot', value, output: DOT_LITERAL });
10918 if (value === '?') {
10919 const isGroup = prev && prev.value === '(';
10920 if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
10921 extglobOpen('qmark', value);
10925 if (prev && prev.type === 'paren') {
10926 const next = peek();
10927 let output = value;
10929 if (next === '<' && !utils.supportsLookbehinds()) {
10930 throw new Error('Node.js v10 or higher is required for regex lookbehinds');
10933 if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
10934 output = `\\${value}`;
10937 push({ type: 'text', value, output });
10941 if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
10942 push({ type: 'qmark', value, output: QMARK_NO_DOT });
10946 push({ type: 'qmark', value, output: QMARK });
10954 if (value === '!') {
10955 if (opts.noextglob !== true && peek() === '(') {
10956 if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
10957 extglobOpen('negate', value);
10962 if (opts.nonegate !== true && state.index === 0) {
10972 if (value === '+') {
10973 if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
10974 extglobOpen('plus', value);
10978 if ((prev && prev.value === '(') || opts.regex === false) {
10979 push({ type: 'plus', value, output: PLUS_LITERAL });
10983 if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
10984 push({ type: 'plus', value });
10988 push({ type: 'plus', value: PLUS_LITERAL });
10996 if (value === '@') {
10997 if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
10998 push({ type: 'at', extglob: true, value, output: '' });
11002 push({ type: 'text', value });
11010 if (value !== '*') {
11011 if (value === '$' || value === '^') {
11012 value = `\\${value}`;
11015 const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
11018 state.index += match[0].length;
11021 push({ type: 'text', value });
11029 if (prev && (prev.type === 'globstar' || prev.star === true)) {
11030 prev.type = 'star';
11032 prev.value += value;
11033 prev.output = star;
11034 state.backtrack = true;
11035 state.globstar = true;
11040 let rest = remaining();
11041 if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
11042 extglobOpen('star', value);
11046 if (prev.type === 'star') {
11047 if (opts.noglobstar === true) {
11052 const prior = prev.prev;
11053 const before = prior.prev;
11054 const isStart = prior.type === 'slash' || prior.type === 'bos';
11055 const afterStar = before && (before.type === 'star' || before.type === 'globstar');
11057 if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
11058 push({ type: 'star', value, output: '' });
11062 const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
11063 const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
11064 if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
11065 push({ type: 'star', value, output: '' });
11069 // strip consecutive `/**/`
11070 while (rest.slice(0, 3) === '/**') {
11071 const after = input[state.index + 4];
11072 if (after && after !== '/') {
11075 rest = rest.slice(3);
11079 if (prior.type === 'bos' && eos()) {
11080 prev.type = 'globstar';
11081 prev.value += value;
11082 prev.output = globstar(opts);
11083 state.output = prev.output;
11084 state.globstar = true;
11089 if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
11090 state.output = state.output.slice(0, -(prior.output + prev.output).length);
11091 prior.output = `(?:${prior.output}`;
11093 prev.type = 'globstar';
11094 prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
11095 prev.value += value;
11096 state.globstar = true;
11097 state.output += prior.output + prev.output;
11102 if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
11103 const end = rest[1] !== void 0 ? '|$' : '';
11105 state.output = state.output.slice(0, -(prior.output + prev.output).length);
11106 prior.output = `(?:${prior.output}`;
11108 prev.type = 'globstar';
11109 prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
11110 prev.value += value;
11112 state.output += prior.output + prev.output;
11113 state.globstar = true;
11115 consume(value + advance());
11117 push({ type: 'slash', value: '/', output: '' });
11121 if (prior.type === 'bos' && rest[0] === '/') {
11122 prev.type = 'globstar';
11123 prev.value += value;
11124 prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
11125 state.output = prev.output;
11126 state.globstar = true;
11127 consume(value + advance());
11128 push({ type: 'slash', value: '/', output: '' });
11132 // remove single star from output
11133 state.output = state.output.slice(0, -prev.output.length);
11135 // reset previous token to globstar
11136 prev.type = 'globstar';
11137 prev.output = globstar(opts);
11138 prev.value += value;
11140 // reset output with globstar
11141 state.output += prev.output;
11142 state.globstar = true;
11147 const token = { type: 'star', value, output: star };
11149 if (opts.bash === true) {
11150 token.output = '.*?';
11151 if (prev.type === 'bos' || prev.type === 'slash') {
11152 token.output = nodot + token.output;
11158 if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
11159 token.output = value;
11164 if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
11165 if (prev.type === 'dot') {
11166 state.output += NO_DOT_SLASH;
11167 prev.output += NO_DOT_SLASH;
11169 } else if (opts.dot === true) {
11170 state.output += NO_DOTS_SLASH;
11171 prev.output += NO_DOTS_SLASH;
11174 state.output += nodot;
11175 prev.output += nodot;
11178 if (peek() !== '*') {
11179 state.output += ONE_CHAR;
11180 prev.output += ONE_CHAR;
11187 while (state.brackets > 0) {
11188 if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
11189 state.output = utils.escapeLast(state.output, '[');
11190 decrement('brackets');
11193 while (state.parens > 0) {
11194 if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
11195 state.output = utils.escapeLast(state.output, '(');
11196 decrement('parens');
11199 while (state.braces > 0) {
11200 if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
11201 state.output = utils.escapeLast(state.output, '{');
11202 decrement('braces');
11205 if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
11206 push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
11209 // rebuild the output if we had to backtrack at any point
11210 if (state.backtrack === true) {
11213 for (const token of state.tokens) {
11214 state.output += token.output != null ? token.output : token.value;
11216 if (token.suffix) {
11217 state.output += token.suffix;
11226 * Fast paths for creating regular expressions for common glob patterns.
11227 * This can significantly speed up processing and has very little downside
11228 * impact when none of the fast paths match.
11231 parse.fastpaths = (input, options) => {
11232 const opts = { ...options };
11233 const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
11234 const len = input.length;
11236 throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
11239 input = REPLACEMENTS[input] || input;
11240 const win32 = utils.isWindows(options);
11242 // create constants based on platform, for windows or posix
11253 } = constants.globChars(win32);
11255 const nodot = opts.dot ? NO_DOTS : NO_DOT;
11256 const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
11257 const capture = opts.capture ? '' : '?:';
11258 const state = { negated: false, prefix: '' };
11259 let star = opts.bash === true ? '.*?' : STAR;
11261 if (opts.capture) {
11262 star = `(${star})`;
11265 const globstar = (opts) => {
11266 if (opts.noglobstar === true) return star;
11267 return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
11270 const create = str => {
11273 return `${nodot}${ONE_CHAR}${star}`;
11276 return `${DOT_LITERAL}${ONE_CHAR}${star}`;
11279 return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
11282 return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
11285 return nodot + globstar(opts);
11288 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
11291 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
11294 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
11297 const match = /^(.*?)\.(\w+)$/.exec(str);
11298 if (!match) return;
11300 const source = create(match[1]);
11301 if (!source) return;
11303 return source + DOT_LITERAL + match[2];
11308 const output = utils.removePrefix(input, state);
11309 let source = create(output);
11311 if (source && opts.strictSlashes !== true) {
11312 source += `${SLASH_LITERAL}?`;
11318 module.exports = parse;
11323 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
11325 const assert = __webpack_require__(58)
11326 const path = __webpack_require__(2)
11327 const fs = __webpack_require__(42)
11328 let glob = undefined
11330 glob = __webpack_require__(59)
11332 // treat glob as optional.
11335 const defaultGlobOpts = {
11340 // for EMFILE handling
11343 const isWindows = (process.platform === "win32")
11345 const defaults = options => {
11354 methods.forEach(m => {
11355 options[m] = options[m] || fs[m]
11357 options[m] = options[m] || fs[m]
11360 options.maxBusyTries = options.maxBusyTries || 3
11361 options.emfileWait = options.emfileWait || 1000
11362 if (options.glob === false) {
11363 options.disableGlob = true
11365 if (options.disableGlob !== true && glob === undefined) {
11366 throw Error('glob dependency not found, set `options.disableGlob = true` if intentional')
11368 options.disableGlob = options.disableGlob || false
11369 options.glob = options.glob || defaultGlobOpts
11372 const rimraf = (p, options, cb) => {
11373 if (typeof options === 'function') {
11378 assert(p, 'rimraf: missing path')
11379 assert.equal(typeof p, 'string', 'rimraf: path should be a string')
11380 assert.equal(typeof cb, 'function', 'rimraf: callback function required')
11381 assert(options, 'rimraf: invalid options argument provided')
11382 assert.equal(typeof options, 'object', 'rimraf: options should be object')
11387 let errState = null
11390 const next = (er) => {
11391 errState = errState || er
11396 const afterGlob = (er, results) => {
11404 results.forEach(p => {
11405 const CB = (er) => {
11407 if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
11408 busyTries < options.maxBusyTries) {
11410 // try again, with the same exact callback as this one.
11411 return setTimeout(() => rimraf_(p, options, CB), busyTries * 100)
11414 // this one won't happen if graceful-fs is used.
11415 if (er.code === "EMFILE" && timeout < options.emfileWait) {
11416 return setTimeout(() => rimraf_(p, options, CB), timeout ++)
11420 if (er.code === "ENOENT") er = null
11426 rimraf_(p, options, CB)
11430 if (options.disableGlob || !glob.hasMagic(p))
11431 return afterGlob(null, [p])
11433 options.lstat(p, (er, stat) => {
11435 return afterGlob(null, [p])
11437 glob(p, options.glob, afterGlob)
11442 // Two possible strategies.
11443 // 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
11444 // 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
11446 // Both result in an extra syscall when you guess wrong. However, there
11447 // are likely far more normal files in the world than directories. This
11448 // is based on the assumption that a the average number of files per
11449 // directory is >= 1.
11451 // If anyone ever complains about this, then I guess the strategy could
11452 // be made configurable somehow. But until then, YAGNI.
11453 const rimraf_ = (p, options, cb) => {
11456 assert(typeof cb === 'function')
11458 // sunos lets the root user unlink directories, which is... weird.
11459 // so we have to lstat here and make sure it's not a dir.
11460 options.lstat(p, (er, st) => {
11461 if (er && er.code === "ENOENT")
11464 // Windows can EPERM on stat. Life is suffering.
11465 if (er && er.code === "EPERM" && isWindows)
11466 fixWinEPERM(p, options, er, cb)
11468 if (st && st.isDirectory())
11469 return rmdir(p, options, er, cb)
11471 options.unlink(p, er => {
11473 if (er.code === "ENOENT")
11475 if (er.code === "EPERM")
11477 ? fixWinEPERM(p, options, er, cb)
11478 : rmdir(p, options, er, cb)
11479 if (er.code === "EISDIR")
11480 return rmdir(p, options, er, cb)
11487 const fixWinEPERM = (p, options, er, cb) => {
11490 assert(typeof cb === 'function')
11492 options.chmod(p, 0o666, er2 => {
11494 cb(er2.code === "ENOENT" ? null : er)
11496 options.stat(p, (er3, stats) => {
11498 cb(er3.code === "ENOENT" ? null : er)
11499 else if (stats.isDirectory())
11500 rmdir(p, options, er, cb)
11502 options.unlink(p, cb)
11507 const fixWinEPERMSync = (p, options, er) => {
11512 options.chmodSync(p, 0o666)
11514 if (er2.code === "ENOENT")
11522 stats = options.statSync(p)
11524 if (er3.code === "ENOENT")
11530 if (stats.isDirectory())
11531 rmdirSync(p, options, er)
11533 options.unlinkSync(p)
11536 const rmdir = (p, options, originalEr, cb) => {
11539 assert(typeof cb === 'function')
11541 // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
11542 // if we guessed wrong, and it's not a directory, then
11543 // raise the original error.
11544 options.rmdir(p, er => {
11545 if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
11546 rmkids(p, options, cb)
11547 else if (er && er.code === "ENOTDIR")
11554 const rmkids = (p, options, cb) => {
11557 assert(typeof cb === 'function')
11559 options.readdir(p, (er, files) => {
11562 let n = files.length
11564 return options.rmdir(p, cb)
11566 files.forEach(f => {
11567 rimraf(path.join(p, f), options, er => {
11571 return cb(errState = er)
11573 options.rmdir(p, cb)
11579 // this looks simpler, and is strictly *faster*, but will
11580 // tie up the JavaScript thread and fail on excessively
11581 // deep directory trees.
11582 const rimrafSync = (p, options) => {
11583 options = options || {}
11586 assert(p, 'rimraf: missing path')
11587 assert.equal(typeof p, 'string', 'rimraf: path should be a string')
11588 assert(options, 'rimraf: missing options')
11589 assert.equal(typeof options, 'object', 'rimraf: options should be object')
11593 if (options.disableGlob || !glob.hasMagic(p)) {
11597 options.lstatSync(p)
11600 results = glob.sync(p, options.glob)
11604 if (!results.length)
11607 for (let i = 0; i < results.length; i++) {
11608 const p = results[i]
11612 st = options.lstatSync(p)
11614 if (er.code === "ENOENT")
11617 // Windows can EPERM on stat. Life is suffering.
11618 if (er.code === "EPERM" && isWindows)
11619 fixWinEPERMSync(p, options, er)
11623 // sunos lets the root user unlink directories, which is... weird.
11624 if (st && st.isDirectory())
11625 rmdirSync(p, options, null)
11627 options.unlinkSync(p)
11629 if (er.code === "ENOENT")
11631 if (er.code === "EPERM")
11632 return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
11633 if (er.code !== "EISDIR")
11636 rmdirSync(p, options, er)
11641 const rmdirSync = (p, options, originalEr) => {
11646 options.rmdirSync(p)
11648 if (er.code === "ENOENT")
11650 if (er.code === "ENOTDIR")
11652 if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
11653 rmkidsSync(p, options)
11657 const rmkidsSync = (p, options) => {
11660 options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
11662 // We only end up here once we got ENOTEMPTY at least once, and
11663 // at this point, we are guaranteed to have removed all the kids.
11664 // So, we know that it won't be ENOENT or ENOTDIR or anything else.
11665 // try really hard to delete stuff on windows, because it has a
11666 // PROFOUNDLY annoying habit of not closing handles promptly when
11667 // files are deleted, resulting in spurious ENOTEMPTY errors.
11668 const retries = isWindows ? 100 : 1
11673 const ret = options.rmdirSync(p, options)
11677 if (++i < retries && threw)
11683 module.exports = rimraf
11684 rimraf.sync = rimrafSync
11689 /***/ ((module) => {
11692 module.exports = require("assert");;
11696 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
11700 // 1. Get the minimatch set
11701 // 2. For each pattern in the set, PROCESS(pattern, false)
11702 // 3. Store matches per-set, then uniq them
11704 // PROCESS(pattern, inGlobStar)
11705 // Get the first [n] items from pattern that are all strings
11706 // Join these together. This is PREFIX.
11707 // If there is no more remaining, then stat(PREFIX) and
11708 // add to matches if it succeeds. END.
11710 // If inGlobStar and PREFIX is symlink and points to dir
11711 // set ENTRIES = []
11712 // else readdir(PREFIX) as ENTRIES
11716 // If pattern[n] is GLOBSTAR
11717 // // handle the case where the globstar match is empty
11718 // // by pruning it out, and testing the resulting pattern
11719 // PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
11720 // // handle other cases.
11721 // for ENTRY in ENTRIES (not dotfiles)
11722 // // attach globstar + tail onto the entry
11723 // // Mark that this entry is a globstar match
11724 // PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
11726 // else // not globstar
11727 // for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
11728 // Test ENTRY against pattern[n]
11729 // If fails, continue
11730 // If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
11733 // Cache all stats and readdirs results to minimize syscall. Since all
11734 // we ever care about is existence and directory-ness, we can just keep
11735 // `true` for files, and [children,...] for directories, or `false` for
11736 // things that don't exist.
11738 module.exports = glob
11740 var fs = __webpack_require__(42)
11741 var rp = __webpack_require__(60)
11742 var minimatch = __webpack_require__(62)
11743 var Minimatch = minimatch.Minimatch
11744 var inherits = __webpack_require__(66)
11745 var EE = __webpack_require__(68).EventEmitter
11746 var path = __webpack_require__(2)
11747 var assert = __webpack_require__(58)
11748 var isAbsolute = __webpack_require__(69)
11749 var globSync = __webpack_require__(70)
11750 var common = __webpack_require__(71)
11751 var alphasort = common.alphasort
11752 var alphasorti = common.alphasorti
11753 var setopts = common.setopts
11754 var ownProp = common.ownProp
11755 var inflight = __webpack_require__(72)
11756 var util = __webpack_require__(50)
11757 var childrenIgnored = common.childrenIgnored
11758 var isIgnored = common.isIgnored
11760 var once = __webpack_require__(74)
11762 function glob (pattern, options, cb) {
11763 if (typeof options === 'function') cb = options, options = {}
11764 if (!options) options = {}
11766 if (options.sync) {
11768 throw new TypeError('callback provided to sync glob')
11769 return globSync(pattern, options)
11772 return new Glob(pattern, options, cb)
11775 glob.sync = globSync
11776 var GlobSync = glob.GlobSync = globSync.GlobSync
11781 function extend (origin, add) {
11782 if (add === null || typeof add !== 'object') {
11786 var keys = Object.keys(add)
11787 var i = keys.length
11789 origin[keys[i]] = add[keys[i]]
11794 glob.hasMagic = function (pattern, options_) {
11795 var options = extend({}, options_)
11796 options.noprocess = true
11798 var g = new Glob(pattern, options)
11799 var set = g.minimatch.set
11804 if (set.length > 1)
11807 for (var j = 0; j < set[0].length; j++) {
11808 if (typeof set[0][j] !== 'string')
11817 function Glob (pattern, options, cb) {
11818 if (typeof options === 'function') {
11823 if (options && options.sync) {
11825 throw new TypeError('callback provided to sync glob')
11826 return new GlobSync(pattern, options)
11829 if (!(this instanceof Glob))
11830 return new Glob(pattern, options, cb)
11832 setopts(this, pattern, options)
11833 this._didRealPath = false
11835 // process each pattern in the minimatch set
11836 var n = this.minimatch.set.length
11838 // The matches are stored as {<filename>: true,...} so that
11839 // duplicates are automagically pruned.
11840 // Later, we do an Object.keys() on these.
11841 // Keep them as a list so we can fill in when nonull is set.
11842 this.matches = new Array(n)
11844 if (typeof cb === 'function') {
11846 this.on('error', cb)
11847 this.on('end', function (matches) {
11853 this._processing = 0
11855 this._emitQueue = []
11856 this._processQueue = []
11857 this.paused = false
11859 if (this.noprocess)
11866 for (var i = 0; i < n; i ++) {
11867 this._process(this.minimatch.set[i], i, false, done)
11873 if (self._processing <= 0) {
11875 process.nextTick(function () {
11885 Glob.prototype._finish = function () {
11886 assert(this instanceof Glob)
11890 if (this.realpath && !this._didRealpath)
11891 return this._realpath()
11893 common.finish(this)
11894 this.emit('end', this.found)
11897 Glob.prototype._realpath = function () {
11898 if (this._didRealpath)
11901 this._didRealpath = true
11903 var n = this.matches.length
11905 return this._finish()
11908 for (var i = 0; i < this.matches.length; i++)
11909 this._realpathSet(i, next)
11917 Glob.prototype._realpathSet = function (index, cb) {
11918 var matchset = this.matches[index]
11922 var found = Object.keys(matchset)
11924 var n = found.length
11929 var set = this.matches[index] = Object.create(null)
11930 found.forEach(function (p, i) {
11931 // If there's a problem with the stat, then it means that
11932 // one or more of the links in the realpath couldn't be
11933 // resolved. just return the abs value in that case.
11934 p = self._makeAbs(p)
11935 rp.realpath(p, self.realpathCache, function (er, real) {
11938 else if (er.syscall === 'stat')
11941 self.emit('error', er) // srsly wtf right here
11944 self.matches[index] = set
11951 Glob.prototype._mark = function (p) {
11952 return common.mark(this, p)
11955 Glob.prototype._makeAbs = function (f) {
11956 return common.makeAbs(this, f)
11959 Glob.prototype.abort = function () {
11960 this.aborted = true
11964 Glob.prototype.pause = function () {
11965 if (!this.paused) {
11971 Glob.prototype.resume = function () {
11973 this.emit('resume')
11974 this.paused = false
11975 if (this._emitQueue.length) {
11976 var eq = this._emitQueue.slice(0)
11977 this._emitQueue.length = 0
11978 for (var i = 0; i < eq.length; i ++) {
11980 this._emitMatch(e[0], e[1])
11983 if (this._processQueue.length) {
11984 var pq = this._processQueue.slice(0)
11985 this._processQueue.length = 0
11986 for (var i = 0; i < pq.length; i ++) {
11989 this._process(p[0], p[1], p[2], p[3])
11995 Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
11996 assert(this instanceof Glob)
11997 assert(typeof cb === 'function')
12004 this._processQueue.push([pattern, index, inGlobStar, cb])
12008 //console.error('PROCESS %d', this._processing, pattern)
12010 // Get the first [n] parts of pattern that are all strings.
12012 while (typeof pattern[n] === 'string') {
12015 // now n is the index of the first one that is *not* a string.
12017 // see if there's anything else
12020 // if not, then this is rather simple
12021 case pattern.length:
12022 this._processSimple(pattern.join('/'), index, cb)
12026 // pattern *starts* with some non-trivial item.
12027 // going to readdir(cwd), but not include the prefix in matches.
12032 // pattern has some string bits in the front.
12033 // whatever it starts with, whether that's 'absolute' like /foo/bar,
12034 // or 'relative' like '../baz'
12035 prefix = pattern.slice(0, n).join('/')
12039 var remain = pattern.slice(n)
12041 // get the list of entries.
12043 if (prefix === null)
12045 else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
12046 if (!prefix || !isAbsolute(prefix))
12047 prefix = '/' + prefix
12052 var abs = this._makeAbs(read)
12054 //if ignored, skip _processing
12055 if (childrenIgnored(this, read))
12058 var isGlobStar = remain[0] === minimatch.GLOBSTAR
12060 this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
12062 this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
12065 Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
12067 this._readdir(abs, inGlobStar, function (er, entries) {
12068 return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
12072 Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
12074 // if the abs isn't a dir, then nothing can match!
12078 // It will only match dot entries if it starts with a dot, or if
12079 // dot is set. Stuff like @(.foo|.bar) isn't allowed.
12081 var negate = !!this.minimatch.negate
12082 var rawGlob = pn._glob
12083 var dotOk = this.dot || rawGlob.charAt(0) === '.'
12085 var matchedEntries = []
12086 for (var i = 0; i < entries.length; i++) {
12088 if (e.charAt(0) !== '.' || dotOk) {
12090 if (negate && !prefix) {
12096 matchedEntries.push(e)
12100 //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
12102 var len = matchedEntries.length
12103 // If there are no matched entries, then nothing matches.
12107 // if this is the last remaining pattern bit, then no need for
12108 // an additional stat *unless* the user has specified mark or
12109 // stat explicitly. We know they exist, since readdir returned
12112 if (remain.length === 1 && !this.mark && !this.stat) {
12113 if (!this.matches[index])
12114 this.matches[index] = Object.create(null)
12116 for (var i = 0; i < len; i ++) {
12117 var e = matchedEntries[i]
12119 if (prefix !== '/')
12120 e = prefix + '/' + e
12125 if (e.charAt(0) === '/' && !this.nomount) {
12126 e = path.join(this.root, e)
12128 this._emitMatch(index, e)
12130 // This was the last one, and no stats were needed
12134 // now test all matched entries as stand-ins for that part
12137 for (var i = 0; i < len; i ++) {
12138 var e = matchedEntries[i]
12141 if (prefix !== '/')
12142 e = prefix + '/' + e
12146 this._process([e].concat(remain), index, inGlobStar, cb)
12151 Glob.prototype._emitMatch = function (index, e) {
12155 if (isIgnored(this, e))
12159 this._emitQueue.push([index, e])
12163 var abs = isAbsolute(e) ? e : this._makeAbs(e)
12171 if (this.matches[index][e])
12175 var c = this.cache[abs]
12176 if (c === 'DIR' || Array.isArray(c))
12180 this.matches[index][e] = true
12182 var st = this.statCache[abs]
12184 this.emit('stat', e, st)
12186 this.emit('match', e)
12189 Glob.prototype._readdirInGlobStar = function (abs, cb) {
12193 // follow all symlinked directories forever
12194 // just proceed as if this is a non-globstar situation
12196 return this._readdir(abs, false, cb)
12198 var lstatkey = 'lstat\0' + abs
12200 var lstatcb = inflight(lstatkey, lstatcb_)
12203 fs.lstat(abs, lstatcb)
12205 function lstatcb_ (er, lstat) {
12206 if (er && er.code === 'ENOENT')
12209 var isSym = lstat && lstat.isSymbolicLink()
12210 self.symlinks[abs] = isSym
12212 // If it's not a symlink or a dir, then it's definitely a regular file.
12213 // don't bother doing a readdir in that case.
12214 if (!isSym && lstat && !lstat.isDirectory()) {
12215 self.cache[abs] = 'FILE'
12218 self._readdir(abs, false, cb)
12222 Glob.prototype._readdir = function (abs, inGlobStar, cb) {
12226 cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
12230 //console.error('RD %j %j', +inGlobStar, abs)
12231 if (inGlobStar && !ownProp(this.symlinks, abs))
12232 return this._readdirInGlobStar(abs, cb)
12234 if (ownProp(this.cache, abs)) {
12235 var c = this.cache[abs]
12236 if (!c || c === 'FILE')
12239 if (Array.isArray(c))
12244 fs.readdir(abs, readdirCb(this, abs, cb))
12247 function readdirCb (self, abs, cb) {
12248 return function (er, entries) {
12250 self._readdirError(abs, er, cb)
12252 self._readdirEntries(abs, entries, cb)
12256 Glob.prototype._readdirEntries = function (abs, entries, cb) {
12260 // if we haven't asked to stat everything, then just
12261 // assume that everything in there exists, so we can avoid
12262 // having to stat it a second time.
12263 if (!this.mark && !this.stat) {
12264 for (var i = 0; i < entries.length; i ++) {
12270 this.cache[e] = true
12274 this.cache[abs] = entries
12275 return cb(null, entries)
12278 Glob.prototype._readdirError = function (f, er, cb) {
12282 // handle errors, and cache the information
12284 case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
12285 case 'ENOTDIR': // totally normal. means it *does* exist.
12286 var abs = this._makeAbs(f)
12287 this.cache[abs] = 'FILE'
12288 if (abs === this.cwdAbs) {
12289 var error = new Error(er.code + ' invalid cwd ' + this.cwd)
12290 error.path = this.cwd
12291 error.code = er.code
12292 this.emit('error', error)
12297 case 'ENOENT': // not terribly unusual
12299 case 'ENAMETOOLONG':
12301 this.cache[this._makeAbs(f)] = false
12304 default: // some unusual error. Treat as failure.
12305 this.cache[this._makeAbs(f)] = false
12307 this.emit('error', er)
12308 // If the error is handled, then we abort
12309 // if not, we threw out of here
12313 console.error('glob error', er)
12320 Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
12322 this._readdir(abs, inGlobStar, function (er, entries) {
12323 self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
12328 Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
12329 //console.error('pgs2', prefix, remain[0], entries)
12331 // no entries means not a dir, so it can never have matches
12332 // foo.txt/** doesn't match foo.txt
12336 // test without the globstar, and with every child both below
12337 // and replacing the globstar.
12338 var remainWithoutGlobStar = remain.slice(1)
12339 var gspref = prefix ? [ prefix ] : []
12340 var noGlobStar = gspref.concat(remainWithoutGlobStar)
12342 // the noGlobStar pattern exits the inGlobStar state
12343 this._process(noGlobStar, index, false, cb)
12345 var isSym = this.symlinks[abs]
12346 var len = entries.length
12348 // If it's a symlink, and we're in a globstar, then stop
12349 if (isSym && inGlobStar)
12352 for (var i = 0; i < len; i++) {
12354 if (e.charAt(0) === '.' && !this.dot)
12357 // these two cases enter the inGlobStar state
12358 var instead = gspref.concat(entries[i], remainWithoutGlobStar)
12359 this._process(instead, index, true, cb)
12361 var below = gspref.concat(entries[i], remain)
12362 this._process(below, index, true, cb)
12368 Glob.prototype._processSimple = function (prefix, index, cb) {
12369 // XXX review this. Shouldn't it be doing the mounting etc
12370 // before doing stat? kinda weird?
12372 this._stat(prefix, function (er, exists) {
12373 self._processSimple2(prefix, index, er, exists, cb)
12376 Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
12378 //console.error('ps2', prefix, exists)
12380 if (!this.matches[index])
12381 this.matches[index] = Object.create(null)
12383 // If it doesn't exist, then just mark the lack of results
12387 if (prefix && isAbsolute(prefix) && !this.nomount) {
12388 var trail = /[\/\\]$/.test(prefix)
12389 if (prefix.charAt(0) === '/') {
12390 prefix = path.join(this.root, prefix)
12392 prefix = path.resolve(this.root, prefix)
12398 if (process.platform === 'win32')
12399 prefix = prefix.replace(/\\/g, '/')
12401 // Mark this as a match
12402 this._emitMatch(index, prefix)
12406 // Returns either 'DIR', 'FILE', or false
12407 Glob.prototype._stat = function (f, cb) {
12408 var abs = this._makeAbs(f)
12409 var needDir = f.slice(-1) === '/'
12411 if (f.length > this.maxLength)
12414 if (!this.stat && ownProp(this.cache, abs)) {
12415 var c = this.cache[abs]
12417 if (Array.isArray(c))
12420 // It exists, but maybe not how we need it
12421 if (!needDir || c === 'DIR')
12424 if (needDir && c === 'FILE')
12427 // otherwise we have to stat, because maybe c=true
12428 // if we know it exists, but not what it is.
12432 var stat = this.statCache[abs]
12433 if (stat !== undefined) {
12434 if (stat === false)
12435 return cb(null, stat)
12437 var type = stat.isDirectory() ? 'DIR' : 'FILE'
12438 if (needDir && type === 'FILE')
12441 return cb(null, type, stat)
12446 var statcb = inflight('stat\0' + abs, lstatcb_)
12448 fs.lstat(abs, statcb)
12450 function lstatcb_ (er, lstat) {
12451 if (lstat && lstat.isSymbolicLink()) {
12452 // If it's a symlink, then treat it as the target, unless
12453 // the target does not exist, then treat it as a file.
12454 return fs.stat(abs, function (er, stat) {
12456 self._stat2(f, abs, null, lstat, cb)
12458 self._stat2(f, abs, er, stat, cb)
12461 self._stat2(f, abs, er, lstat, cb)
12466 Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
12467 if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
12468 this.statCache[abs] = false
12472 var needDir = f.slice(-1) === '/'
12473 this.statCache[abs] = stat
12475 if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
12476 return cb(null, false, stat)
12480 c = stat.isDirectory() ? 'DIR' : 'FILE'
12481 this.cache[abs] = this.cache[abs] || c
12483 if (needDir && c === 'FILE')
12486 return cb(null, c, stat)
12492 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
12494 module.exports = realpath
12495 realpath.realpath = realpath
12496 realpath.sync = realpathSync
12497 realpath.realpathSync = realpathSync
12498 realpath.monkeypatch = monkeypatch
12499 realpath.unmonkeypatch = unmonkeypatch
12501 var fs = __webpack_require__(42)
12502 var origRealpath = fs.realpath
12503 var origRealpathSync = fs.realpathSync
12505 var version = process.version
12506 var ok = /^v[0-5]\./.test(version)
12507 var old = __webpack_require__(61)
12509 function newError (er) {
12510 return er && er.syscall === 'realpath' && (
12511 er.code === 'ELOOP' ||
12512 er.code === 'ENOMEM' ||
12513 er.code === 'ENAMETOOLONG'
12517 function realpath (p, cache, cb) {
12519 return origRealpath(p, cache, cb)
12522 if (typeof cache === 'function') {
12526 origRealpath(p, cache, function (er, result) {
12527 if (newError(er)) {
12528 old.realpath(p, cache, cb)
12535 function realpathSync (p, cache) {
12537 return origRealpathSync(p, cache)
12541 return origRealpathSync(p, cache)
12543 if (newError(er)) {
12544 return old.realpathSync(p, cache)
12551 function monkeypatch () {
12552 fs.realpath = realpath
12553 fs.realpathSync = realpathSync
12556 function unmonkeypatch () {
12557 fs.realpath = origRealpath
12558 fs.realpathSync = origRealpathSync
12564 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12566 // Copyright Joyent, Inc. and other Node contributors.
12568 // Permission is hereby granted, free of charge, to any person obtaining a
12569 // copy of this software and associated documentation files (the
12570 // "Software"), to deal in the Software without restriction, including
12571 // without limitation the rights to use, copy, modify, merge, publish,
12572 // distribute, sublicense, and/or sell copies of the Software, and to permit
12573 // persons to whom the Software is furnished to do so, subject to the
12574 // following conditions:
12576 // The above copyright notice and this permission notice shall be included
12577 // in all copies or substantial portions of the Software.
12579 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12580 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12581 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
12582 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
12583 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
12584 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
12585 // USE OR OTHER DEALINGS IN THE SOFTWARE.
12587 var pathModule = __webpack_require__(2);
12588 var isWindows = process.platform === 'win32';
12589 var fs = __webpack_require__(42);
12591 // JavaScript implementation of realpath, ported from node pre-v6
12593 var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
12595 function rethrow() {
12596 // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
12597 // is fairly slow to generate.
12600 var backtrace = new Error;
12601 callback = debugCallback;
12603 callback = missingCallback;
12607 function debugCallback(err) {
12609 backtrace.message = err.message;
12611 missingCallback(err);
12615 function missingCallback(err) {
12617 if (process.throwDeprecation)
12618 throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs
12619 else if (!process.noDeprecation) {
12620 var msg = 'fs: missing callback ' + (err.stack || err.message);
12621 if (process.traceDeprecation)
12622 console.trace(msg);
12624 console.error(msg);
12630 function maybeCallback(cb) {
12631 return typeof cb === 'function' ? cb : rethrow();
12634 var normalize = pathModule.normalize;
12636 // Regexp that finds the next partion of a (partial) path
12637 // result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
12639 var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
12641 var nextPartRe = /(.*?)(?:[\/]+|$)/g;
12644 // Regex to find the device root, including trailing slash. E.g. 'c:\\'.
12646 var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
12648 var splitRootRe = /^[\/]*/;
12651 exports.realpathSync = function realpathSync(p, cache) {
12652 // make p is absolute
12653 p = pathModule.resolve(p);
12655 if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
12663 // current character position in p
12665 // the partial path so far, including a trailing slash if any
12667 // the partial path without a trailing slash (except when pointing at a root)
12669 // the partial path scanned in the previous round, with slash
12676 var m = splitRootRe.exec(p);
12682 // On windows, check that the root exists. On unix there is no need.
12683 if (isWindows && !knownHard[base]) {
12684 fs.lstatSync(base);
12685 knownHard[base] = true;
12689 // walk down the path, swapping out linked pathparts for their real
12691 // NB: p.length changes.
12692 while (pos < p.length) {
12693 // find the next part
12694 nextPartRe.lastIndex = pos;
12695 var result = nextPartRe.exec(p);
12696 previous = current;
12697 current += result[0];
12698 base = previous + result[1];
12699 pos = nextPartRe.lastIndex;
12701 // continue if not a symlink
12702 if (knownHard[base] || (cache && cache[base] === base)) {
12707 if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
12708 // some known symbolic link. no need to stat again.
12709 resolvedLink = cache[base];
12711 var stat = fs.lstatSync(base);
12712 if (!stat.isSymbolicLink()) {
12713 knownHard[base] = true;
12714 if (cache) cache[base] = base;
12718 // read the link if it wasn't read before
12719 // dev/ino always return 0 on windows, so skip the check.
12720 var linkTarget = null;
12722 var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
12723 if (seenLinks.hasOwnProperty(id)) {
12724 linkTarget = seenLinks[id];
12727 if (linkTarget === null) {
12729 linkTarget = fs.readlinkSync(base);
12731 resolvedLink = pathModule.resolve(previous, linkTarget);
12732 // track this, if given a cache.
12733 if (cache) cache[base] = resolvedLink;
12734 if (!isWindows) seenLinks[id] = linkTarget;
12737 // resolve the link, then start over
12738 p = pathModule.resolve(resolvedLink, p.slice(pos));
12742 if (cache) cache[original] = p;
12748 exports.realpath = function realpath(p, cache, cb) {
12749 if (typeof cb !== 'function') {
12750 cb = maybeCallback(cache);
12754 // make p is absolute
12755 p = pathModule.resolve(p);
12757 if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
12758 return process.nextTick(cb.bind(null, null, cache[p]));
12765 // current character position in p
12767 // the partial path so far, including a trailing slash if any
12769 // the partial path without a trailing slash (except when pointing at a root)
12771 // the partial path scanned in the previous round, with slash
12778 var m = splitRootRe.exec(p);
12784 // On windows, check that the root exists. On unix there is no need.
12785 if (isWindows && !knownHard[base]) {
12786 fs.lstat(base, function(err) {
12787 if (err) return cb(err);
12788 knownHard[base] = true;
12792 process.nextTick(LOOP);
12796 // walk down the path, swapping out linked pathparts for their real
12799 // stop if scanned past end of path
12800 if (pos >= p.length) {
12801 if (cache) cache[original] = p;
12802 return cb(null, p);
12805 // find the next part
12806 nextPartRe.lastIndex = pos;
12807 var result = nextPartRe.exec(p);
12808 previous = current;
12809 current += result[0];
12810 base = previous + result[1];
12811 pos = nextPartRe.lastIndex;
12813 // continue if not a symlink
12814 if (knownHard[base] || (cache && cache[base] === base)) {
12815 return process.nextTick(LOOP);
12818 if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
12819 // known symbolic link. no need to stat again.
12820 return gotResolvedLink(cache[base]);
12823 return fs.lstat(base, gotStat);
12826 function gotStat(err, stat) {
12827 if (err) return cb(err);
12829 // if not a symlink, skip to the next path part
12830 if (!stat.isSymbolicLink()) {
12831 knownHard[base] = true;
12832 if (cache) cache[base] = base;
12833 return process.nextTick(LOOP);
12836 // stat & read the link if not read before
12837 // call gotTarget as soon as the link target is known
12838 // dev/ino always return 0 on windows, so skip the check.
12840 var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
12841 if (seenLinks.hasOwnProperty(id)) {
12842 return gotTarget(null, seenLinks[id], base);
12845 fs.stat(base, function(err) {
12846 if (err) return cb(err);
12848 fs.readlink(base, function(err, target) {
12849 if (!isWindows) seenLinks[id] = target;
12850 gotTarget(err, target);
12855 function gotTarget(err, target, base) {
12856 if (err) return cb(err);
12858 var resolvedLink = pathModule.resolve(previous, target);
12859 if (cache) cache[base] = resolvedLink;
12860 gotResolvedLink(resolvedLink);
12863 function gotResolvedLink(resolvedLink) {
12864 // resolve the link, then start over
12865 p = pathModule.resolve(resolvedLink, p.slice(pos));
12873 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
12875 module.exports = minimatch
12876 minimatch.Minimatch = Minimatch
12878 var path = { sep: '/' }
12880 path = __webpack_require__(2)
12883 var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
12884 var expand = __webpack_require__(63)
12887 '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
12888 '?': { open: '(?:', close: ')?' },
12889 '+': { open: '(?:', close: ')+' },
12890 '*': { open: '(?:', close: ')*' },
12891 '@': { open: '(?:', close: ')' }
12894 // any single thing other than /
12895 // don't need to escape / when using new RegExp()
12898 // * => any number of characters
12899 var star = qmark + '*?'
12901 // ** when dots are allowed. Anything goes, except .. and .
12902 // not (^ or / followed by one or two dots followed by $ or /),
12903 // followed by anything, any number of times.
12904 var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
12906 // not a ^ or / followed by a dot,
12907 // followed by anything, any number of times.
12908 var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
12910 // characters that need to be escaped in RegExp.
12911 var reSpecials = charSet('().*{}+?[]^$\\!')
12913 // "abc" -> { a:true, b:true, c:true }
12914 function charSet (s) {
12915 return s.split('').reduce(function (set, c) {
12921 // normalizes slashes.
12922 var slashSplit = /\/+/
12924 minimatch.filter = filter
12925 function filter (pattern, options) {
12926 options = options || {}
12927 return function (p, i, list) {
12928 return minimatch(p, pattern, options)
12932 function ext (a, b) {
12936 Object.keys(b).forEach(function (k) {
12939 Object.keys(a).forEach(function (k) {
12945 minimatch.defaults = function (def) {
12946 if (!def || !Object.keys(def).length) return minimatch
12948 var orig = minimatch
12950 var m = function minimatch (p, pattern, options) {
12951 return orig.minimatch(p, pattern, ext(def, options))
12954 m.Minimatch = function Minimatch (pattern, options) {
12955 return new orig.Minimatch(pattern, ext(def, options))
12961 Minimatch.defaults = function (def) {
12962 if (!def || !Object.keys(def).length) return Minimatch
12963 return minimatch.defaults(def).Minimatch
12966 function minimatch (p, pattern, options) {
12967 if (typeof pattern !== 'string') {
12968 throw new TypeError('glob pattern string required')
12971 if (!options) options = {}
12973 // shortcut: comments match nothing.
12974 if (!options.nocomment && pattern.charAt(0) === '#') {
12978 // "" only matches ""
12979 if (pattern.trim() === '') return p === ''
12981 return new Minimatch(pattern, options).match(p)
12984 function Minimatch (pattern, options) {
12985 if (!(this instanceof Minimatch)) {
12986 return new Minimatch(pattern, options)
12989 if (typeof pattern !== 'string') {
12990 throw new TypeError('glob pattern string required')
12993 if (!options) options = {}
12994 pattern = pattern.trim()
12996 // windows support: need to use /, not \
12997 if (path.sep !== '/') {
12998 pattern = pattern.split(path.sep).join('/')
13001 this.options = options
13003 this.pattern = pattern
13005 this.negate = false
13006 this.comment = false
13009 // make the set of regexps etc.
13013 Minimatch.prototype.debug = function () {}
13015 Minimatch.prototype.make = make
13017 // don't do it more than once.
13018 if (this._made) return
13020 var pattern = this.pattern
13021 var options = this.options
13023 // empty patterns and comments match nothing.
13024 if (!options.nocomment && pattern.charAt(0) === '#') {
13025 this.comment = true
13033 // step 1: figure out negation, etc.
13036 // step 2: expand braces
13037 var set = this.globSet = this.braceExpand()
13039 if (options.debug) this.debug = console.error
13041 this.debug(this.pattern, set)
13043 // step 3: now we have a set, so turn each one into a series of path-portion
13044 // matching patterns.
13045 // These will be regexps, except in the case of "**", which is
13046 // set to the GLOBSTAR object for globstar behavior,
13047 // and will not contain any / characters
13048 set = this.globParts = set.map(function (s) {
13049 return s.split(slashSplit)
13052 this.debug(this.pattern, set)
13054 // glob --> regexps
13055 set = set.map(function (s, si, set) {
13056 return s.map(this.parse, this)
13059 this.debug(this.pattern, set)
13061 // filter out everything that didn't compile properly.
13062 set = set.filter(function (s) {
13063 return s.indexOf(false) === -1
13066 this.debug(this.pattern, set)
13071 Minimatch.prototype.parseNegate = parseNegate
13072 function parseNegate () {
13073 var pattern = this.pattern
13075 var options = this.options
13076 var negateOffset = 0
13078 if (options.nonegate) return
13080 for (var i = 0, l = pattern.length
13081 ; i < l && pattern.charAt(i) === '!'
13087 if (negateOffset) this.pattern = pattern.substr(negateOffset)
13088 this.negate = negate
13091 // Brace expansion:
13092 // a{b,c}d -> abd acd
13093 // a{b,}c -> abc ac
13094 // a{0..3}d -> a0d a1d a2d a3d
13095 // a{b,c{d,e}f}g -> abg acdfg acefg
13096 // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
13098 // Invalid sets are not expanded.
13099 // a{2..}b -> a{2..}b
13101 minimatch.braceExpand = function (pattern, options) {
13102 return braceExpand(pattern, options)
13105 Minimatch.prototype.braceExpand = braceExpand
13107 function braceExpand (pattern, options) {
13109 if (this instanceof Minimatch) {
13110 options = this.options
13116 pattern = typeof pattern === 'undefined'
13117 ? this.pattern : pattern
13119 if (typeof pattern === 'undefined') {
13120 throw new TypeError('undefined pattern')
13123 if (options.nobrace ||
13124 !pattern.match(/\{.*\}/)) {
13125 // shortcut. no need to expand.
13129 return expand(pattern)
13132 // parse a component of the expanded set.
13133 // At this point, no pattern may contain "/" in it
13134 // so we're going to return a 2d array, where each entry is the full
13135 // pattern, split on '/', and then turned into a regular expression.
13136 // A regexp is made at the end which joins each array with an
13137 // escaped /, and another full one which joins each regexp with |.
13139 // Following the lead of Bash 4.1, note that "**" only has special meaning
13140 // when it is the *only* thing in a path portion. Otherwise, any series
13141 // of * is equivalent to a single *. Globstar behavior is enabled by
13142 // default, and can be disabled by setting options.noglobstar.
13143 Minimatch.prototype.parse = parse
13145 function parse (pattern, isSub) {
13146 if (pattern.length > 1024 * 64) {
13147 throw new TypeError('pattern is too long')
13150 var options = this.options
13153 if (!options.noglobstar && pattern === '**') return GLOBSTAR
13154 if (pattern === '') return ''
13157 var hasMagic = !!options.nocase
13158 var escaping = false
13159 // ? => one single character
13160 var patternListStack = []
13161 var negativeLists = []
13163 var inClass = false
13164 var reClassStart = -1
13165 var classStart = -1
13166 // . and .. never match anything that doesn't start with .,
13167 // even when options.dot is set.
13168 var patternStart = pattern.charAt(0) === '.' ? '' // anything
13169 // not (start or / followed by . or .. followed by / or end)
13170 : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
13174 function clearStateChar () {
13176 // we had some state-tracking character
13177 // that wasn't consumed by this pass.
13178 switch (stateChar) {
13188 re += '\\' + stateChar
13191 self.debug('clearStateChar %j %j', stateChar, re)
13196 for (var i = 0, len = pattern.length, c
13197 ; (i < len) && (c = pattern.charAt(i))
13199 this.debug('%s\t%s %s %j', pattern, i, re, c)
13201 // skip over any that are escaped.
13202 if (escaping && reSpecials[c]) {
13210 // completely not allowed, even escaped.
13211 // Should already be path-split by now.
13219 // the various stateChar values
13220 // for the "extglob" stuff.
13226 this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
13228 // all of those are literals inside a class, except that
13229 // the glob [!a] means [^a] in regexp
13231 this.debug(' in class')
13232 if (c === '!' && i === classStart + 1) c = '^'
13237 // if we already have a stateChar, then it means
13238 // that there was something like ** or +? in there.
13239 // Handle the stateChar, then proceed with this one.
13240 self.debug('call clearStateChar %j', stateChar)
13243 // if extglob is disabled, then +(asdf|foo) isn't a thing.
13244 // just clear the statechar *now*, rather than even diving into
13245 // the patternList stuff.
13246 if (options.noext) clearStateChar()
13260 patternListStack.push({
13263 reStart: re.length,
13264 open: plTypes[stateChar].open,
13265 close: plTypes[stateChar].close
13267 // negation is (?:(?!js)[^/]*)
13268 re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
13269 this.debug('plType %j %j', stateChar, re)
13274 if (inClass || !patternListStack.length) {
13281 var pl = patternListStack.pop()
13282 // negation is (?:(?!js)[^/]*)
13283 // The others are (?:<pattern>)<type>
13285 if (pl.type === '!') {
13286 negativeLists.push(pl)
13288 pl.reEnd = re.length
13292 if (inClass || !patternListStack.length || escaping) {
13302 // these are mostly the same in regexp and glob
13304 // swallow any state-tracking char before the [
13314 reClassStart = re.length
13319 // a right bracket shall lose its special
13320 // meaning and represent itself in
13321 // a bracket expression if it occurs
13322 // first in the list. -- POSIX.2 2.8.3.2
13323 if (i === classStart + 1 || !inClass) {
13329 // handle the case where we left a class open.
13330 // "[z-a]" is valid, equivalent to "\[z-a\]"
13332 // split where the last [ was, make sure we don't have
13333 // an invalid re. if so, re-walk the contents of the
13334 // would-be class to re-translate any characters that
13335 // were passed through as-is
13336 // TODO: It would probably be faster to determine this
13337 // without a try/catch and a new RegExp, but it's tricky
13338 // to do safely. For now, this is safe and works.
13339 var cs = pattern.substring(classStart + 1, i)
13341 RegExp('[' + cs + ']')
13343 // not a valid class!
13344 var sp = this.parse(cs, SUBPARSE)
13345 re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
13346 hasMagic = hasMagic || sp[1]
13352 // finish up the class.
13359 // swallow any state char that wasn't consumed
13365 } else if (reSpecials[c]
13366 && !(c === '^' && inClass)) {
13375 // handle the case where we left a class open.
13376 // "[abc" is valid, equivalent to "\[abc"
13378 // split where the last [ was, and escape it
13379 // this is a huge pita. We now have to re-walk
13380 // the contents of the would-be class to re-translate
13381 // any characters that were passed through as-is
13382 cs = pattern.substr(classStart + 1)
13383 sp = this.parse(cs, SUBPARSE)
13384 re = re.substr(0, reClassStart) + '\\[' + sp[0]
13385 hasMagic = hasMagic || sp[1]
13388 // handle the case where we had a +( thing at the *end*
13390 // each pattern list stack adds 3 chars, and we need to go through
13391 // and escape any | chars that were passed through as-is for the regexp.
13392 // Go through and escape them, taking care not to double-escape any
13393 // | chars that were already escaped.
13394 for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
13395 var tail = re.slice(pl.reStart + pl.open.length)
13396 this.debug('setting tail', re, pl)
13397 // maybe some even number of \, then maybe 1 \, followed by a |
13398 tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
13400 // the | isn't already escaped, so escape it.
13404 // need to escape all those slashes *again*, without escaping the
13405 // one that we need for escaping the | character. As it works out,
13406 // escaping an even number of slashes can be done by simply repeating
13407 // it exactly after itself. That's why this trick works.
13409 // I am sorry that you have to see this.
13410 return $1 + $1 + $2 + '|'
13413 this.debug('tail=%j\n %s', tail, tail, pl, re)
13414 var t = pl.type === '*' ? star
13415 : pl.type === '?' ? qmark
13419 re = re.slice(0, pl.reStart) + t + '\\(' + tail
13422 // handle trailing things that only matter at the very end.
13429 // only need to apply the nodot start if the re starts with
13430 // something that could conceivably capture a dot
13431 var addPatternStart = false
13432 switch (re.charAt(0)) {
13435 case '(': addPatternStart = true
13438 // Hack to work around lack of negative lookbehind in JS
13439 // A pattern like: *.!(x).!(y|z) needs to ensure that a name
13440 // like 'a.xyz.yz' doesn't match. So, the first negative
13441 // lookahead, has to look ALL the way ahead, to the end of
13443 for (var n = negativeLists.length - 1; n > -1; n--) {
13444 var nl = negativeLists[n]
13446 var nlBefore = re.slice(0, nl.reStart)
13447 var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
13448 var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
13449 var nlAfter = re.slice(nl.reEnd)
13453 // Handle nested stuff like *(*.js|!(*.json)), where open parens
13454 // mean that we should *not* include the ) in the bit that is considered
13455 // "after" the negated section.
13456 var openParensBefore = nlBefore.split('(').length - 1
13457 var cleanAfter = nlAfter
13458 for (i = 0; i < openParensBefore; i++) {
13459 cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
13461 nlAfter = cleanAfter
13464 if (nlAfter === '' && isSub !== SUBPARSE) {
13467 var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
13471 // if the re is not "" at this point, then we need to make sure
13472 // it doesn't match against an empty path part.
13473 // Otherwise a/* will match a/, which it should not.
13474 if (re !== '' && hasMagic) {
13478 if (addPatternStart) {
13479 re = patternStart + re
13482 // parsing just a piece of a larger pattern.
13483 if (isSub === SUBPARSE) {
13484 return [re, hasMagic]
13487 // skip the regexp for non-magical patterns
13488 // unescape anything in it, though, so that it'll be
13489 // an exact match against a file etc.
13491 return globUnescape(pattern)
13494 var flags = options.nocase ? 'i' : ''
13496 var regExp = new RegExp('^' + re + '$', flags)
13498 // If it was an invalid regular expression, then it can't match
13499 // anything. This trick looks for a character after the end of
13500 // the string, which is of course impossible, except in multi-line
13501 // mode, but it's not a /m regex.
13502 return new RegExp('$.')
13505 regExp._glob = pattern
13511 minimatch.makeRe = function (pattern, options) {
13512 return new Minimatch(pattern, options || {}).makeRe()
13515 Minimatch.prototype.makeRe = makeRe
13516 function makeRe () {
13517 if (this.regexp || this.regexp === false) return this.regexp
13519 // at this point, this.set is a 2d array of partial
13520 // pattern strings, or "**".
13522 // It's better to use .match(). This function shouldn't
13523 // be used, really, but it's pretty convenient sometimes,
13524 // when you just want to work with a regex.
13528 this.regexp = false
13531 var options = this.options
13533 var twoStar = options.noglobstar ? star
13534 : options.dot ? twoStarDot
13536 var flags = options.nocase ? 'i' : ''
13538 var re = set.map(function (pattern) {
13539 return pattern.map(function (p) {
13540 return (p === GLOBSTAR) ? twoStar
13541 : (typeof p === 'string') ? regExpEscape(p)
13546 // must match entire pattern
13547 // ending in a * or ** will make it less strict.
13548 re = '^(?:' + re + ')$'
13550 // can match anything, as long as it's not this.
13551 if (this.negate) re = '^(?!' + re + ').*$'
13554 this.regexp = new RegExp(re, flags)
13556 this.regexp = false
13561 minimatch.match = function (list, pattern, options) {
13562 options = options || {}
13563 var mm = new Minimatch(pattern, options)
13564 list = list.filter(function (f) {
13567 if (mm.options.nonull && !list.length) {
13573 Minimatch.prototype.match = match
13574 function match (f, partial) {
13575 this.debug('match', f, this.pattern)
13576 // short-circuit in the case of busted things.
13578 if (this.comment) return false
13579 if (this.empty) return f === ''
13581 if (f === '/' && partial) return true
13583 var options = this.options
13585 // windows: need to use /, not \
13586 if (path.sep !== '/') {
13587 f = f.split(path.sep).join('/')
13590 // treat the test path as a set of pathparts.
13591 f = f.split(slashSplit)
13592 this.debug(this.pattern, 'split', f)
13594 // just ONE of the pattern sets in this.set needs to match
13595 // in order for it to be valid. If negating, then just one
13596 // match means that we have failed.
13597 // Either way, return on the first hit.
13600 this.debug(this.pattern, 'set', set)
13602 // Find the basename of the path by looking for the last non-empty segment
13605 for (i = f.length - 1; i >= 0; i--) {
13607 if (filename) break
13610 for (i = 0; i < set.length; i++) {
13611 var pattern = set[i]
13613 if (options.matchBase && pattern.length === 1) {
13616 var hit = this.matchOne(file, pattern, partial)
13618 if (options.flipNegate) return true
13619 return !this.negate
13623 // didn't get any hits. this is success if it's a negative
13624 // pattern, failure otherwise.
13625 if (options.flipNegate) return false
13629 // set partial to true to test if, for example,
13630 // "/a/b" matches the start of "/*/b/*/d"
13631 // Partial means, if you run out of file before you run
13632 // out of pattern, then that's fine, as long as all
13633 // the parts match.
13634 Minimatch.prototype.matchOne = function (file, pattern, partial) {
13635 var options = this.options
13637 this.debug('matchOne',
13638 { 'this': this, file: file, pattern: pattern })
13640 this.debug('matchOne', file.length, pattern.length)
13645 pl = pattern.length
13646 ; (fi < fl) && (pi < pl)
13648 this.debug('matchOne loop')
13649 var p = pattern[pi]
13652 this.debug(pattern, p, f)
13654 // should be impossible.
13655 // some invalid regexp stuff in the set.
13656 if (p === false) return false
13658 if (p === GLOBSTAR) {
13659 this.debug('GLOBSTAR', [pattern, p, f])
13662 // a/**/b/**/c would match the following:
13667 // To do this, take the rest of the pattern after
13668 // the **, and see if it would match the file remainder.
13669 // If so, return success.
13670 // If not, the ** "swallows" a segment, and try again.
13671 // This is recursively awful.
13673 // a/**/b/**/c matching a/b/x/y/z/c
13676 // - matchOne(b/x/y/z/c, b/**/c)
13679 // - matchOne(x/y/z/c, c) -> no
13680 // - matchOne(y/z/c, c) -> no
13681 // - matchOne(z/c, c) -> no
13682 // - matchOne(c, c) yes, hit
13686 this.debug('** at the end')
13687 // a ** at the end will just swallow the rest.
13688 // We have found a match.
13689 // however, it will not swallow /.x, unless
13690 // options.dot is set.
13691 // . and .. are *never* matched by **, for explosively
13692 // exponential reasons.
13693 for (; fi < fl; fi++) {
13694 if (file[fi] === '.' || file[fi] === '..' ||
13695 (!options.dot && file[fi].charAt(0) === '.')) return false
13700 // ok, let's see if we can swallow whatever we can.
13702 var swallowee = file[fr]
13704 this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
13706 // XXX remove this slice. Just pass the start index.
13707 if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
13708 this.debug('globstar found match!', fr, fl, swallowee)
13712 // can't swallow "." or ".." ever.
13713 // can only swallow ".foo" when explicitly asked.
13714 if (swallowee === '.' || swallowee === '..' ||
13715 (!options.dot && swallowee.charAt(0) === '.')) {
13716 this.debug('dot detected!', file, fr, pattern, pr)
13720 // ** swallows a segment, and continue.
13721 this.debug('globstar swallow a segment, and continue')
13726 // no match was found.
13727 // However, in partial mode, we can't say this is necessarily over.
13728 // If there's more *pattern* left, then
13731 this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
13732 if (fr === fl) return true
13737 // something other than **
13738 // non-magic patterns just have to match exactly
13739 // patterns with magic have been turned into regexps.
13741 if (typeof p === 'string') {
13742 if (options.nocase) {
13743 hit = f.toLowerCase() === p.toLowerCase()
13747 this.debug('string match', p, f, hit)
13750 this.debug('pattern match', p, f, hit)
13753 if (!hit) return false
13756 // Note: ending in / means that we'll get a final ""
13757 // at the end of the pattern. This can only match a
13758 // corresponding "" at the end of the file.
13759 // If the file ends in /, then it can only match a
13760 // a pattern that ends in /, unless the pattern just
13761 // doesn't have any more for it. But, a/b/ should *not*
13762 // match "a/b/*", even though "" matches against the
13763 // [^/]*? pattern, except in partial mode, where it might
13764 // simply not be reached yet.
13765 // However, a/b/ should still satisfy a/*
13767 // now either we fell off the end of the pattern, or we're done.
13768 if (fi === fl && pi === pl) {
13769 // ran out of pattern and filename at the same time.
13772 } else if (fi === fl) {
13773 // ran out of file, but still had pattern left.
13774 // this is ok if we're doing the match as part of
13775 // a glob fs traversal.
13777 } else if (pi === pl) {
13778 // ran out of pattern, still have file left.
13779 // this is only acceptable if we're on the very last
13780 // empty segment of a file with a trailing slash.
13781 // a/* should match a/b/
13782 var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
13783 return emptyFileEnd
13786 // should be unreachable.
13787 throw new Error('wtf?')
13790 // replace stuff like \* with *
13791 function globUnescape (s) {
13792 return s.replace(/\\(.)/g, '$1')
13795 function regExpEscape (s) {
13796 return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
13802 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
13804 var concatMap = __webpack_require__(64);
13805 var balanced = __webpack_require__(65);
13807 module.exports = expandTop;
13809 var escSlash = '\0SLASH'+Math.random()+'\0';
13810 var escOpen = '\0OPEN'+Math.random()+'\0';
13811 var escClose = '\0CLOSE'+Math.random()+'\0';
13812 var escComma = '\0COMMA'+Math.random()+'\0';
13813 var escPeriod = '\0PERIOD'+Math.random()+'\0';
13815 function numeric(str) {
13816 return parseInt(str, 10) == str
13817 ? parseInt(str, 10)
13818 : str.charCodeAt(0);
13821 function escapeBraces(str) {
13822 return str.split('\\\\').join(escSlash)
13823 .split('\\{').join(escOpen)
13824 .split('\\}').join(escClose)
13825 .split('\\,').join(escComma)
13826 .split('\\.').join(escPeriod);
13829 function unescapeBraces(str) {
13830 return str.split(escSlash).join('\\')
13831 .split(escOpen).join('{')
13832 .split(escClose).join('}')
13833 .split(escComma).join(',')
13834 .split(escPeriod).join('.');
13838 // Basically just str.split(","), but handling cases
13839 // where we have nested braced sections, which should be
13840 // treated as individual members, like {a,{b,c},d}
13841 function parseCommaParts(str) {
13846 var m = balanced('{', '}', str);
13849 return str.split(',');
13854 var p = pre.split(',');
13856 p[p.length-1] += '{' + body + '}';
13857 var postParts = parseCommaParts(post);
13859 p[p.length-1] += postParts.shift();
13860 p.push.apply(p, postParts);
13863 parts.push.apply(parts, p);
13868 function expandTop(str) {
13872 // I don't know why Bash 4.3 does this, but it does.
13873 // Anything starting with {} will have the first two bytes preserved
13874 // but *only* at the top level, so {},a}b will not expand to anything,
13875 // but a{},b}c will be expanded to [a}c,abc].
13876 // One could argue that this is a bug in Bash, but since the goal of
13877 // this module is to match Bash's rules, we escape a leading {}
13878 if (str.substr(0, 2) === '{}') {
13879 str = '\\{\\}' + str.substr(2);
13882 return expand(escapeBraces(str), true).map(unescapeBraces);
13885 function identity(e) {
13889 function embrace(str) {
13890 return '{' + str + '}';
13892 function isPadded(el) {
13893 return /^-?0\d/.test(el);
13896 function lte(i, y) {
13899 function gte(i, y) {
13903 function expand(str, isTop) {
13904 var expansions = [];
13906 var m = balanced('{', '}', str);
13907 if (!m || /\$$/.test(m.pre)) return [str];
13909 var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
13910 var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
13911 var isSequence = isNumericSequence || isAlphaSequence;
13912 var isOptions = m.body.indexOf(',') >= 0;
13913 if (!isSequence && !isOptions) {
13915 if (m.post.match(/,.*\}/)) {
13916 str = m.pre + '{' + m.body + escClose + m.post;
13917 return expand(str);
13924 n = m.body.split(/\.\./);
13926 n = parseCommaParts(m.body);
13927 if (n.length === 1) {
13928 // x{{a,b}}y ==> x{a}y x{b}y
13929 n = expand(n[0], false).map(embrace);
13930 if (n.length === 1) {
13931 var post = m.post.length
13932 ? expand(m.post, false)
13934 return post.map(function(p) {
13935 return m.pre + n[0] + p;
13941 // at this point, n is the parts, and we know it's not a comma set
13942 // with a single entry.
13944 // no need to expand pre, since it is guaranteed to be free of brace-sets
13946 var post = m.post.length
13947 ? expand(m.post, false)
13953 var x = numeric(n[0]);
13954 var y = numeric(n[1]);
13955 var width = Math.max(n[0].length, n[1].length)
13956 var incr = n.length == 3
13957 ? Math.abs(numeric(n[2]))
13960 var reverse = y < x;
13965 var pad = n.some(isPadded);
13969 for (var i = x; test(i, y); i += incr) {
13971 if (isAlphaSequence) {
13972 c = String.fromCharCode(i);
13978 var need = width - c.length;
13980 var z = new Array(need + 1).join('0');
13982 c = '-' + z + c.slice(1);
13991 N = concatMap(n, function(el) { return expand(el, false) });
13994 for (var j = 0; j < N.length; j++) {
13995 for (var k = 0; k < post.length; k++) {
13996 var expansion = pre + N[j] + post[k];
13997 if (!isTop || isSequence || expansion)
13998 expansions.push(expansion);
14009 /***/ ((module) => {
14011 module.exports = function (xs, fn) {
14013 for (var i = 0; i < xs.length; i++) {
14014 var x = fn(xs[i], i);
14015 if (isArray(x)) res.push.apply(res, x);
14021 var isArray = Array.isArray || function (xs) {
14022 return Object.prototype.toString.call(xs) === '[object Array]';
14028 /***/ ((module) => {
14032 module.exports = balanced;
14033 function balanced(a, b, str) {
14034 if (a instanceof RegExp) a = maybeMatch(a, str);
14035 if (b instanceof RegExp) b = maybeMatch(b, str);
14037 var r = range(a, b, str);
14042 pre: str.slice(0, r[0]),
14043 body: str.slice(r[0] + a.length, r[1]),
14044 post: str.slice(r[1] + b.length)
14048 function maybeMatch(reg, str) {
14049 var m = str.match(reg);
14050 return m ? m[0] : null;
14053 balanced.range = range;
14054 function range(a, b, str) {
14055 var begs, beg, left, right, result;
14056 var ai = str.indexOf(a);
14057 var bi = str.indexOf(b, ai + 1);
14060 if (ai >= 0 && bi > 0) {
14064 while (i >= 0 && !result) {
14067 ai = str.indexOf(a, i + 1);
14068 } else if (begs.length == 1) {
14069 result = [ begs.pop(), bi ];
14077 bi = str.indexOf(b, i + 1);
14080 i = ai < bi && ai >= 0 ? ai : bi;
14084 result = [ left, right ];
14094 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14097 var util = __webpack_require__(50);
14098 /* istanbul ignore next */
14099 if (typeof util.inherits !== 'function') throw '';
14100 module.exports = util.inherits;
14102 /* istanbul ignore next */
14103 module.exports = __webpack_require__(67);
14109 /***/ ((module) => {
14111 if (typeof Object.create === 'function') {
14112 // implementation from standard node.js 'util' module
14113 module.exports = function inherits(ctor, superCtor) {
14115 ctor.super_ = superCtor
14116 ctor.prototype = Object.create(superCtor.prototype, {
14127 // old school shim for old browsers
14128 module.exports = function inherits(ctor, superCtor) {
14130 ctor.super_ = superCtor
14131 var TempCtor = function () {}
14132 TempCtor.prototype = superCtor.prototype
14133 ctor.prototype = new TempCtor()
14134 ctor.prototype.constructor = ctor
14142 /***/ ((module) => {
14145 module.exports = require("events");;
14149 /***/ ((module) => {
14154 function posix(path) {
14155 return path.charAt(0) === '/';
14158 function win32(path) {
14159 // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
14160 var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
14161 var result = splitDeviceRe.exec(path);
14162 var device = result[1] || '';
14163 var isUnc = Boolean(device && device.charAt(1) !== ':');
14165 // UNC paths are always absolute
14166 return Boolean(result[2] || isUnc);
14169 module.exports = process.platform === 'win32' ? win32 : posix;
14170 module.exports.posix = posix;
14171 module.exports.win32 = win32;
14176 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14178 module.exports = globSync
14179 globSync.GlobSync = GlobSync
14181 var fs = __webpack_require__(42)
14182 var rp = __webpack_require__(60)
14183 var minimatch = __webpack_require__(62)
14184 var Minimatch = minimatch.Minimatch
14185 var Glob = __webpack_require__(59).Glob
14186 var util = __webpack_require__(50)
14187 var path = __webpack_require__(2)
14188 var assert = __webpack_require__(58)
14189 var isAbsolute = __webpack_require__(69)
14190 var common = __webpack_require__(71)
14191 var alphasort = common.alphasort
14192 var alphasorti = common.alphasorti
14193 var setopts = common.setopts
14194 var ownProp = common.ownProp
14195 var childrenIgnored = common.childrenIgnored
14196 var isIgnored = common.isIgnored
14198 function globSync (pattern, options) {
14199 if (typeof options === 'function' || arguments.length === 3)
14200 throw new TypeError('callback provided to sync glob\n'+
14201 'See: https://github.com/isaacs/node-glob/issues/167')
14203 return new GlobSync(pattern, options).found
14206 function GlobSync (pattern, options) {
14208 throw new Error('must provide pattern')
14210 if (typeof options === 'function' || arguments.length === 3)
14211 throw new TypeError('callback provided to sync glob\n'+
14212 'See: https://github.com/isaacs/node-glob/issues/167')
14214 if (!(this instanceof GlobSync))
14215 return new GlobSync(pattern, options)
14217 setopts(this, pattern, options)
14219 if (this.noprocess)
14222 var n = this.minimatch.set.length
14223 this.matches = new Array(n)
14224 for (var i = 0; i < n; i ++) {
14225 this._process(this.minimatch.set[i], i, false)
14230 GlobSync.prototype._finish = function () {
14231 assert(this instanceof GlobSync)
14232 if (this.realpath) {
14234 this.matches.forEach(function (matchset, index) {
14235 var set = self.matches[index] = Object.create(null)
14236 for (var p in matchset) {
14238 p = self._makeAbs(p)
14239 var real = rp.realpathSync(p, self.realpathCache)
14242 if (er.syscall === 'stat')
14243 set[self._makeAbs(p)] = true
14250 common.finish(this)
14254 GlobSync.prototype._process = function (pattern, index, inGlobStar) {
14255 assert(this instanceof GlobSync)
14257 // Get the first [n] parts of pattern that are all strings.
14259 while (typeof pattern[n] === 'string') {
14262 // now n is the index of the first one that is *not* a string.
14264 // See if there's anything else
14267 // if not, then this is rather simple
14268 case pattern.length:
14269 this._processSimple(pattern.join('/'), index)
14273 // pattern *starts* with some non-trivial item.
14274 // going to readdir(cwd), but not include the prefix in matches.
14279 // pattern has some string bits in the front.
14280 // whatever it starts with, whether that's 'absolute' like /foo/bar,
14281 // or 'relative' like '../baz'
14282 prefix = pattern.slice(0, n).join('/')
14286 var remain = pattern.slice(n)
14288 // get the list of entries.
14290 if (prefix === null)
14292 else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
14293 if (!prefix || !isAbsolute(prefix))
14294 prefix = '/' + prefix
14299 var abs = this._makeAbs(read)
14301 //if ignored, skip processing
14302 if (childrenIgnored(this, read))
14305 var isGlobStar = remain[0] === minimatch.GLOBSTAR
14307 this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
14309 this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
14313 GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
14314 var entries = this._readdir(abs, inGlobStar)
14316 // if the abs isn't a dir, then nothing can match!
14320 // It will only match dot entries if it starts with a dot, or if
14321 // dot is set. Stuff like @(.foo|.bar) isn't allowed.
14323 var negate = !!this.minimatch.negate
14324 var rawGlob = pn._glob
14325 var dotOk = this.dot || rawGlob.charAt(0) === '.'
14327 var matchedEntries = []
14328 for (var i = 0; i < entries.length; i++) {
14330 if (e.charAt(0) !== '.' || dotOk) {
14332 if (negate && !prefix) {
14338 matchedEntries.push(e)
14342 var len = matchedEntries.length
14343 // If there are no matched entries, then nothing matches.
14347 // if this is the last remaining pattern bit, then no need for
14348 // an additional stat *unless* the user has specified mark or
14349 // stat explicitly. We know they exist, since readdir returned
14352 if (remain.length === 1 && !this.mark && !this.stat) {
14353 if (!this.matches[index])
14354 this.matches[index] = Object.create(null)
14356 for (var i = 0; i < len; i ++) {
14357 var e = matchedEntries[i]
14359 if (prefix.slice(-1) !== '/')
14360 e = prefix + '/' + e
14365 if (e.charAt(0) === '/' && !this.nomount) {
14366 e = path.join(this.root, e)
14368 this._emitMatch(index, e)
14370 // This was the last one, and no stats were needed
14374 // now test all matched entries as stand-ins for that part
14377 for (var i = 0; i < len; i ++) {
14378 var e = matchedEntries[i]
14381 newPattern = [prefix, e]
14384 this._process(newPattern.concat(remain), index, inGlobStar)
14389 GlobSync.prototype._emitMatch = function (index, e) {
14390 if (isIgnored(this, e))
14393 var abs = this._makeAbs(e)
14398 if (this.absolute) {
14402 if (this.matches[index][e])
14406 var c = this.cache[abs]
14407 if (c === 'DIR' || Array.isArray(c))
14411 this.matches[index][e] = true
14418 GlobSync.prototype._readdirInGlobStar = function (abs) {
14419 // follow all symlinked directories forever
14420 // just proceed as if this is a non-globstar situation
14422 return this._readdir(abs, false)
14428 lstat = fs.lstatSync(abs)
14430 if (er.code === 'ENOENT') {
14431 // lstat failed, doesn't exist
14436 var isSym = lstat && lstat.isSymbolicLink()
14437 this.symlinks[abs] = isSym
14439 // If it's not a symlink or a dir, then it's definitely a regular file.
14440 // don't bother doing a readdir in that case.
14441 if (!isSym && lstat && !lstat.isDirectory())
14442 this.cache[abs] = 'FILE'
14444 entries = this._readdir(abs, false)
14449 GlobSync.prototype._readdir = function (abs, inGlobStar) {
14452 if (inGlobStar && !ownProp(this.symlinks, abs))
14453 return this._readdirInGlobStar(abs)
14455 if (ownProp(this.cache, abs)) {
14456 var c = this.cache[abs]
14457 if (!c || c === 'FILE')
14460 if (Array.isArray(c))
14465 return this._readdirEntries(abs, fs.readdirSync(abs))
14467 this._readdirError(abs, er)
14472 GlobSync.prototype._readdirEntries = function (abs, entries) {
14473 // if we haven't asked to stat everything, then just
14474 // assume that everything in there exists, so we can avoid
14475 // having to stat it a second time.
14476 if (!this.mark && !this.stat) {
14477 for (var i = 0; i < entries.length; i ++) {
14483 this.cache[e] = true
14487 this.cache[abs] = entries
14489 // mark and cache dir-ness
14493 GlobSync.prototype._readdirError = function (f, er) {
14494 // handle errors, and cache the information
14496 case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
14497 case 'ENOTDIR': // totally normal. means it *does* exist.
14498 var abs = this._makeAbs(f)
14499 this.cache[abs] = 'FILE'
14500 if (abs === this.cwdAbs) {
14501 var error = new Error(er.code + ' invalid cwd ' + this.cwd)
14502 error.path = this.cwd
14503 error.code = er.code
14508 case 'ENOENT': // not terribly unusual
14510 case 'ENAMETOOLONG':
14512 this.cache[this._makeAbs(f)] = false
14515 default: // some unusual error. Treat as failure.
14516 this.cache[this._makeAbs(f)] = false
14520 console.error('glob error', er)
14525 GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
14527 var entries = this._readdir(abs, inGlobStar)
14529 // no entries means not a dir, so it can never have matches
14530 // foo.txt/** doesn't match foo.txt
14534 // test without the globstar, and with every child both below
14535 // and replacing the globstar.
14536 var remainWithoutGlobStar = remain.slice(1)
14537 var gspref = prefix ? [ prefix ] : []
14538 var noGlobStar = gspref.concat(remainWithoutGlobStar)
14540 // the noGlobStar pattern exits the inGlobStar state
14541 this._process(noGlobStar, index, false)
14543 var len = entries.length
14544 var isSym = this.symlinks[abs]
14546 // If it's a symlink, and we're in a globstar, then stop
14547 if (isSym && inGlobStar)
14550 for (var i = 0; i < len; i++) {
14552 if (e.charAt(0) === '.' && !this.dot)
14555 // these two cases enter the inGlobStar state
14556 var instead = gspref.concat(entries[i], remainWithoutGlobStar)
14557 this._process(instead, index, true)
14559 var below = gspref.concat(entries[i], remain)
14560 this._process(below, index, true)
14564 GlobSync.prototype._processSimple = function (prefix, index) {
14565 // XXX review this. Shouldn't it be doing the mounting etc
14566 // before doing stat? kinda weird?
14567 var exists = this._stat(prefix)
14569 if (!this.matches[index])
14570 this.matches[index] = Object.create(null)
14572 // If it doesn't exist, then just mark the lack of results
14576 if (prefix && isAbsolute(prefix) && !this.nomount) {
14577 var trail = /[\/\\]$/.test(prefix)
14578 if (prefix.charAt(0) === '/') {
14579 prefix = path.join(this.root, prefix)
14581 prefix = path.resolve(this.root, prefix)
14587 if (process.platform === 'win32')
14588 prefix = prefix.replace(/\\/g, '/')
14590 // Mark this as a match
14591 this._emitMatch(index, prefix)
14594 // Returns either 'DIR', 'FILE', or false
14595 GlobSync.prototype._stat = function (f) {
14596 var abs = this._makeAbs(f)
14597 var needDir = f.slice(-1) === '/'
14599 if (f.length > this.maxLength)
14602 if (!this.stat && ownProp(this.cache, abs)) {
14603 var c = this.cache[abs]
14605 if (Array.isArray(c))
14608 // It exists, but maybe not how we need it
14609 if (!needDir || c === 'DIR')
14612 if (needDir && c === 'FILE')
14615 // otherwise we have to stat, because maybe c=true
14616 // if we know it exists, but not what it is.
14620 var stat = this.statCache[abs]
14624 lstat = fs.lstatSync(abs)
14626 if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
14627 this.statCache[abs] = false
14632 if (lstat && lstat.isSymbolicLink()) {
14634 stat = fs.statSync(abs)
14643 this.statCache[abs] = stat
14647 c = stat.isDirectory() ? 'DIR' : 'FILE'
14649 this.cache[abs] = this.cache[abs] || c
14651 if (needDir && c === 'FILE')
14657 GlobSync.prototype._mark = function (p) {
14658 return common.mark(this, p)
14661 GlobSync.prototype._makeAbs = function (f) {
14662 return common.makeAbs(this, f)
14668 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
14670 exports.alphasort = alphasort
14671 exports.alphasorti = alphasorti
14672 exports.setopts = setopts
14673 exports.ownProp = ownProp
14674 exports.makeAbs = makeAbs
14675 exports.finish = finish
14676 exports.mark = mark
14677 exports.isIgnored = isIgnored
14678 exports.childrenIgnored = childrenIgnored
14680 function ownProp (obj, field) {
14681 return Object.prototype.hasOwnProperty.call(obj, field)
14684 var path = __webpack_require__(2)
14685 var minimatch = __webpack_require__(62)
14686 var isAbsolute = __webpack_require__(69)
14687 var Minimatch = minimatch.Minimatch
14689 function alphasorti (a, b) {
14690 return a.toLowerCase().localeCompare(b.toLowerCase())
14693 function alphasort (a, b) {
14694 return a.localeCompare(b)
14697 function setupIgnores (self, options) {
14698 self.ignore = options.ignore || []
14700 if (!Array.isArray(self.ignore))
14701 self.ignore = [self.ignore]
14703 if (self.ignore.length) {
14704 self.ignore = self.ignore.map(ignoreMap)
14708 // ignore patterns are always in dot:true mode.
14709 function ignoreMap (pattern) {
14710 var gmatcher = null
14711 if (pattern.slice(-3) === '/**') {
14712 var gpattern = pattern.replace(/(\/\*\*)+$/, '')
14713 gmatcher = new Minimatch(gpattern, { dot: true })
14717 matcher: new Minimatch(pattern, { dot: true }),
14722 function setopts (self, pattern, options) {
14726 // base-matching: just use globstar for that.
14727 if (options.matchBase && -1 === pattern.indexOf("/")) {
14728 if (options.noglobstar) {
14729 throw new Error("base matching requires globstar")
14731 pattern = "**/" + pattern
14734 self.silent = !!options.silent
14735 self.pattern = pattern
14736 self.strict = options.strict !== false
14737 self.realpath = !!options.realpath
14738 self.realpathCache = options.realpathCache || Object.create(null)
14739 self.follow = !!options.follow
14740 self.dot = !!options.dot
14741 self.mark = !!options.mark
14742 self.nodir = !!options.nodir
14745 self.sync = !!options.sync
14746 self.nounique = !!options.nounique
14747 self.nonull = !!options.nonull
14748 self.nosort = !!options.nosort
14749 self.nocase = !!options.nocase
14750 self.stat = !!options.stat
14751 self.noprocess = !!options.noprocess
14752 self.absolute = !!options.absolute
14754 self.maxLength = options.maxLength || Infinity
14755 self.cache = options.cache || Object.create(null)
14756 self.statCache = options.statCache || Object.create(null)
14757 self.symlinks = options.symlinks || Object.create(null)
14759 setupIgnores(self, options)
14761 self.changedCwd = false
14762 var cwd = process.cwd()
14763 if (!ownProp(options, "cwd"))
14766 self.cwd = path.resolve(options.cwd)
14767 self.changedCwd = self.cwd !== cwd
14770 self.root = options.root || path.resolve(self.cwd, "/")
14771 self.root = path.resolve(self.root)
14772 if (process.platform === "win32")
14773 self.root = self.root.replace(/\\/g, "/")
14775 // TODO: is an absolute `cwd` supposed to be resolved against `root`?
14776 // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
14777 self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
14778 if (process.platform === "win32")
14779 self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
14780 self.nomount = !!options.nomount
14782 // disable comments and negation in Minimatch.
14783 // Note that they are not supported in Glob itself anyway.
14784 options.nonegate = true
14785 options.nocomment = true
14787 self.minimatch = new Minimatch(pattern, options)
14788 self.options = self.minimatch.options
14791 function finish (self) {
14792 var nou = self.nounique
14793 var all = nou ? [] : Object.create(null)
14795 for (var i = 0, l = self.matches.length; i < l; i ++) {
14796 var matches = self.matches[i]
14797 if (!matches || Object.keys(matches).length === 0) {
14799 // do like the shell, and spit out the literal glob
14800 var literal = self.minimatch.globSet[i]
14804 all[literal] = true
14808 var m = Object.keys(matches)
14810 all.push.apply(all, m)
14812 m.forEach(function (m) {
14819 all = Object.keys(all)
14822 all = all.sort(self.nocase ? alphasorti : alphasort)
14824 // at *some* point we statted all of these
14826 for (var i = 0; i < all.length; i++) {
14827 all[i] = self._mark(all[i])
14830 all = all.filter(function (e) {
14831 var notDir = !(/\/$/.test(e))
14832 var c = self.cache[e] || self.cache[makeAbs(self, e)]
14834 notDir = c !== 'DIR' && !Array.isArray(c)
14840 if (self.ignore.length)
14841 all = all.filter(function(m) {
14842 return !isIgnored(self, m)
14848 function mark (self, p) {
14849 var abs = makeAbs(self, p)
14850 var c = self.cache[abs]
14853 var isDir = c === 'DIR' || Array.isArray(c)
14854 var slash = p.slice(-1) === '/'
14856 if (isDir && !slash)
14858 else if (!isDir && slash)
14862 var mabs = makeAbs(self, m)
14863 self.statCache[mabs] = self.statCache[abs]
14864 self.cache[mabs] = self.cache[abs]
14872 function makeAbs (self, f) {
14874 if (f.charAt(0) === '/') {
14875 abs = path.join(self.root, f)
14876 } else if (isAbsolute(f) || f === '') {
14878 } else if (self.changedCwd) {
14879 abs = path.resolve(self.cwd, f)
14881 abs = path.resolve(f)
14884 if (process.platform === 'win32')
14885 abs = abs.replace(/\\/g, '/')
14891 // Return true, if pattern ends with globstar '**', for the accompanying parent directory.
14892 // Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
14893 function isIgnored (self, path) {
14894 if (!self.ignore.length)
14897 return self.ignore.some(function(item) {
14898 return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
14902 function childrenIgnored (self, path) {
14903 if (!self.ignore.length)
14906 return self.ignore.some(function(item) {
14907 return !!(item.gmatcher && item.gmatcher.match(path))
14914 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14916 var wrappy = __webpack_require__(73)
14917 var reqs = Object.create(null)
14918 var once = __webpack_require__(74)
14920 module.exports = wrappy(inflight)
14922 function inflight (key, cb) {
14928 return makeres(key)
14932 function makeres (key) {
14933 return once(function RES () {
14934 var cbs = reqs[key]
14935 var len = cbs.length
14936 var args = slice(arguments)
14938 // XXX It's somewhat ambiguous whether a new callback added in this
14939 // pass should be queued for later execution if something in the
14940 // list of callbacks throws, or if it should just be discarded.
14941 // However, it's such an edge case that it hardly matters, and either
14942 // choice is likely as surprising as the other.
14943 // As it happens, we do go ahead and schedule it for later execution.
14945 for (var i = 0; i < len; i++) {
14946 cbs[i].apply(null, args)
14949 if (cbs.length > len) {
14950 // added more in the interim.
14951 // de-zalgo, just in case, but don't call again.
14953 process.nextTick(function () {
14954 RES.apply(null, args)
14963 function slice (args) {
14964 var length = args.length
14967 for (var i = 0; i < length; i++) array[i] = args[i]
14974 /***/ ((module) => {
14976 // Returns a wrapper function that returns a wrapped callback
14977 // The wrapper function should do some stuff, and return a
14978 // presumably different callback function.
14979 // This makes sure that own properties are retained, so that
14980 // decorations and such are not lost along the way.
14981 module.exports = wrappy
14982 function wrappy (fn, cb) {
14983 if (fn && cb) return wrappy(fn)(cb)
14985 if (typeof fn !== 'function')
14986 throw new TypeError('need wrapper function')
14988 Object.keys(fn).forEach(function (k) {
14994 function wrapper() {
14995 var args = new Array(arguments.length)
14996 for (var i = 0; i < args.length; i++) {
14997 args[i] = arguments[i]
14999 var ret = fn.apply(this, args)
15000 var cb = args[args.length-1]
15001 if (typeof ret === 'function' && ret !== cb) {
15002 Object.keys(cb).forEach(function (k) {
15013 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15015 var wrappy = __webpack_require__(73)
15016 module.exports = wrappy(once)
15017 module.exports.strict = wrappy(onceStrict)
15019 once.proto = once(function () {
15020 Object.defineProperty(Function.prototype, 'once', {
15021 value: function () {
15027 Object.defineProperty(Function.prototype, 'onceStrict', {
15028 value: function () {
15029 return onceStrict(this)
15035 function once (fn) {
15036 var f = function () {
15037 if (f.called) return f.value
15039 return f.value = fn.apply(this, arguments)
15045 function onceStrict (fn) {
15046 var f = function () {
15048 throw new Error(f.onceError)
15050 return f.value = fn.apply(this, arguments)
15052 var name = fn.name || 'Function wrapped with `once`'
15053 f.onceError = name + " shouldn't be called more than once"
15061 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15063 // just pre-load all the stuff that index.js lazily exports
15064 const internalRe = __webpack_require__(76)
15067 src: internalRe.src,
15068 tokens: internalRe.t,
15069 SEMVER_SPEC_VERSION: __webpack_require__(77).SEMVER_SPEC_VERSION,
15070 SemVer: __webpack_require__(79),
15071 compareIdentifiers: __webpack_require__(80).compareIdentifiers,
15072 rcompareIdentifiers: __webpack_require__(80).rcompareIdentifiers,
15073 parse: __webpack_require__(81),
15074 valid: __webpack_require__(82),
15075 clean: __webpack_require__(83),
15076 inc: __webpack_require__(84),
15077 diff: __webpack_require__(85),
15078 major: __webpack_require__(88),
15079 minor: __webpack_require__(89),
15080 patch: __webpack_require__(90),
15081 prerelease: __webpack_require__(91),
15082 compare: __webpack_require__(87),
15083 rcompare: __webpack_require__(92),
15084 compareLoose: __webpack_require__(93),
15085 compareBuild: __webpack_require__(94),
15086 sort: __webpack_require__(95),
15087 rsort: __webpack_require__(96),
15088 gt: __webpack_require__(97),
15089 lt: __webpack_require__(98),
15090 eq: __webpack_require__(86),
15091 neq: __webpack_require__(99),
15092 gte: __webpack_require__(100),
15093 lte: __webpack_require__(101),
15094 cmp: __webpack_require__(102),
15095 coerce: __webpack_require__(103),
15096 Comparator: __webpack_require__(104),
15097 Range: __webpack_require__(105),
15098 satisfies: __webpack_require__(106),
15099 toComparators: __webpack_require__(107),
15100 maxSatisfying: __webpack_require__(108),
15101 minSatisfying: __webpack_require__(109),
15102 minVersion: __webpack_require__(110),
15103 validRange: __webpack_require__(111),
15104 outside: __webpack_require__(112),
15105 gtr: __webpack_require__(113),
15106 ltr: __webpack_require__(114),
15107 intersects: __webpack_require__(115),
15108 simplifyRange: __webpack_require__(116),
15109 subset: __webpack_require__(117),
15115 /***/ ((module, exports, __webpack_require__) => {
15117 const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(77)
15118 const debug = __webpack_require__(78)
15119 exports = module.exports = {}
15121 // The actual regexps go on exports.re
15122 const re = exports.re = []
15123 const src = exports.src = []
15124 const t = exports.t = {}
15127 const createToken = (name, value, isGlobal) => {
15129 debug(index, value)
15132 re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
15135 // The following Regular Expressions can be used for tokenizing,
15136 // validating, and parsing SemVer version strings.
15138 // ## Numeric Identifier
15139 // A single `0`, or a non-zero digit followed by zero or more digits.
15141 createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
15142 createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
15144 // ## Non-numeric Identifier
15145 // Zero or more digits, followed by a letter or hyphen, and then zero or
15146 // more letters, digits, or hyphens.
15148 createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
15151 // Three dot-separated numeric identifiers.
15153 createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
15154 `(${src[t.NUMERICIDENTIFIER]})\\.` +
15155 `(${src[t.NUMERICIDENTIFIER]})`)
15157 createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
15158 `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
15159 `(${src[t.NUMERICIDENTIFIERLOOSE]})`)
15161 // ## Pre-release Version Identifier
15162 // A numeric identifier, or a non-numeric identifier.
15164 createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
15165 }|${src[t.NONNUMERICIDENTIFIER]})`)
15167 createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
15168 }|${src[t.NONNUMERICIDENTIFIER]})`)
15170 // ## Pre-release Version
15171 // Hyphen, followed by one or more dot-separated pre-release version
15174 createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
15175 }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
15177 createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
15178 }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
15180 // ## Build Metadata Identifier
15181 // Any combination of digits, letters, or hyphens.
15183 createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
15185 // ## Build Metadata
15186 // Plus sign, followed by one or more period-separated build metadata
15189 createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
15190 }(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
15192 // ## Full Version String
15193 // A main version, followed optionally by a pre-release version and
15196 // Note that the only major, minor, patch, and pre-release sections of
15197 // the version string are capturing groups. The build metadata is not a
15198 // capturing group, because it should not ever be used in version
15201 createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
15202 }${src[t.PRERELEASE]}?${
15205 createToken('FULL', `^${src[t.FULLPLAIN]}$`)
15207 // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
15208 // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
15209 // common in the npm registry.
15210 createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
15211 }${src[t.PRERELEASELOOSE]}?${
15214 createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
15216 createToken('GTLT', '((?:<|>)?=?)')
15218 // Something like "2.*" or "1.2.x".
15219 // Note that "x.x" is a valid xRange identifer, meaning "any version"
15220 // Only the first item is strictly required.
15221 createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
15222 createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
15224 createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
15225 `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
15226 `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
15227 `(?:${src[t.PRERELEASE]})?${
15231 createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
15232 `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
15233 `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
15234 `(?:${src[t.PRERELEASELOOSE]})?${
15238 createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
15239 createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
15242 // Extract anything that could conceivably be a part of a valid semver
15243 createToken('COERCE', `${'(^|[^\\d])' +
15244 '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
15245 `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
15246 `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
15248 createToken('COERCERTL', src[t.COERCE], true)
15251 // Meaning is "reasonably at or greater than"
15252 createToken('LONETILDE', '(?:~>?)')
15254 createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
15255 exports.tildeTrimReplace = '$1~'
15257 createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
15258 createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
15261 // Meaning is "at least and backwards compatible with"
15262 createToken('LONECARET', '(?:\\^)')
15264 createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
15265 exports.caretTrimReplace = '$1^'
15267 createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
15268 createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
15270 // A simple gt/lt/eq thing, or just "" to indicate "any version"
15271 createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
15272 createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
15274 // An expression to strip any whitespace between the gtlt and the thing
15275 // it modifies, so that `> 1.2.3` ==> `>1.2.3`
15276 createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
15277 }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
15278 exports.comparatorTrimReplace = '$1$2$3'
15280 // Something like `1.2.3 - 1.2.4`
15281 // Note that these all use the loose form, because they'll be
15282 // checked against either the strict or loose comparator form
15284 createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
15286 `(${src[t.XRANGEPLAIN]})` +
15289 createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
15291 `(${src[t.XRANGEPLAINLOOSE]})` +
15294 // Star ranges basically just allow anything at all.
15295 createToken('STAR', '(<|>)?=?\\s*\\*')
15296 // >=0.0.0 is like a star
15297 createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
15298 createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
15303 /***/ ((module) => {
15305 // Note: this is the semver.org version of the spec that it implements
15306 // Not necessarily the package version of this code.
15307 const SEMVER_SPEC_VERSION = '2.0.0'
15309 const MAX_LENGTH = 256
15310 const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
15311 /* istanbul ignore next */ 9007199254740991
15313 // Max safe segment length for coercion.
15314 const MAX_SAFE_COMPONENT_LENGTH = 16
15317 SEMVER_SPEC_VERSION,
15320 MAX_SAFE_COMPONENT_LENGTH
15326 /***/ ((module) => {
15329 typeof process === 'object' &&
15331 process.env.NODE_DEBUG &&
15332 /\bsemver\b/i.test(process.env.NODE_DEBUG)
15333 ) ? (...args) => console.error('SEMVER', ...args)
15336 module.exports = debug
15341 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15343 const debug = __webpack_require__(78)
15344 const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(77)
15345 const { re, t } = __webpack_require__(76)
15347 const { compareIdentifiers } = __webpack_require__(80)
15349 constructor (version, options) {
15350 if (!options || typeof options !== 'object') {
15353 includePrerelease: false
15356 if (version instanceof SemVer) {
15357 if (version.loose === !!options.loose &&
15358 version.includePrerelease === !!options.includePrerelease) {
15361 version = version.version
15363 } else if (typeof version !== 'string') {
15364 throw new TypeError(`Invalid Version: ${version}`)
15367 if (version.length > MAX_LENGTH) {
15368 throw new TypeError(
15369 `version is longer than ${MAX_LENGTH} characters`
15373 debug('SemVer', version, options)
15374 this.options = options
15375 this.loose = !!options.loose
15376 // this isn't actually relevant for versions, but keep it so that we
15377 // don't run into trouble passing this.options around.
15378 this.includePrerelease = !!options.includePrerelease
15380 const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
15383 throw new TypeError(`Invalid Version: ${version}`)
15388 // these are actually numbers
15393 if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
15394 throw new TypeError('Invalid major version')
15397 if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
15398 throw new TypeError('Invalid minor version')
15401 if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
15402 throw new TypeError('Invalid patch version')
15405 // numberify any prerelease numeric ids
15407 this.prerelease = []
15409 this.prerelease = m[4].split('.').map((id) => {
15410 if (/^[0-9]+$/.test(id)) {
15412 if (num >= 0 && num < MAX_SAFE_INTEGER) {
15420 this.build = m[5] ? m[5].split('.') : []
15425 this.version = `${this.major}.${this.minor}.${this.patch}`
15426 if (this.prerelease.length) {
15427 this.version += `-${this.prerelease.join('.')}`
15429 return this.version
15433 return this.version
15437 debug('SemVer.compare', this.version, this.options, other)
15438 if (!(other instanceof SemVer)) {
15439 if (typeof other === 'string' && other === this.version) {
15442 other = new SemVer(other, this.options)
15445 if (other.version === this.version) {
15449 return this.compareMain(other) || this.comparePre(other)
15452 compareMain (other) {
15453 if (!(other instanceof SemVer)) {
15454 other = new SemVer(other, this.options)
15458 compareIdentifiers(this.major, other.major) ||
15459 compareIdentifiers(this.minor, other.minor) ||
15460 compareIdentifiers(this.patch, other.patch)
15464 comparePre (other) {
15465 if (!(other instanceof SemVer)) {
15466 other = new SemVer(other, this.options)
15469 // NOT having a prerelease is > having one
15470 if (this.prerelease.length && !other.prerelease.length) {
15472 } else if (!this.prerelease.length && other.prerelease.length) {
15474 } else if (!this.prerelease.length && !other.prerelease.length) {
15480 const a = this.prerelease[i]
15481 const b = other.prerelease[i]
15482 debug('prerelease compare', i, a, b)
15483 if (a === undefined && b === undefined) {
15485 } else if (b === undefined) {
15487 } else if (a === undefined) {
15489 } else if (a === b) {
15492 return compareIdentifiers(a, b)
15497 compareBuild (other) {
15498 if (!(other instanceof SemVer)) {
15499 other = new SemVer(other, this.options)
15504 const a = this.build[i]
15505 const b = other.build[i]
15506 debug('prerelease compare', i, a, b)
15507 if (a === undefined && b === undefined) {
15509 } else if (b === undefined) {
15511 } else if (a === undefined) {
15513 } else if (a === b) {
15516 return compareIdentifiers(a, b)
15521 // preminor will bump the version up to the next minor release, and immediately
15522 // down to pre-release. premajor and prepatch work the same way.
15523 inc (release, identifier) {
15526 this.prerelease.length = 0
15530 this.inc('pre', identifier)
15533 this.prerelease.length = 0
15536 this.inc('pre', identifier)
15539 // If this is already a prerelease, it will bump to the next version
15540 // drop any prereleases that might already exist, since they are not
15541 // relevant at this point.
15542 this.prerelease.length = 0
15543 this.inc('patch', identifier)
15544 this.inc('pre', identifier)
15546 // If the input is a non-prerelease version, this acts the same as
15549 if (this.prerelease.length === 0) {
15550 this.inc('patch', identifier)
15552 this.inc('pre', identifier)
15556 // If this is a pre-major version, bump up to the same major version.
15557 // Otherwise increment major.
15558 // 1.0.0-5 bumps to 1.0.0
15559 // 1.1.0 bumps to 2.0.0
15561 this.minor !== 0 ||
15562 this.patch !== 0 ||
15563 this.prerelease.length === 0
15569 this.prerelease = []
15572 // If this is a pre-minor version, bump up to the same minor version.
15573 // Otherwise increment minor.
15574 // 1.2.0-5 bumps to 1.2.0
15575 // 1.2.1 bumps to 1.3.0
15576 if (this.patch !== 0 || this.prerelease.length === 0) {
15580 this.prerelease = []
15583 // If this is not a pre-release version, it will increment the patch.
15584 // If it is a pre-release it will bump up to the same patch version.
15585 // 1.2.0-5 patches to 1.2.0
15586 // 1.2.0 patches to 1.2.1
15587 if (this.prerelease.length === 0) {
15590 this.prerelease = []
15592 // This probably shouldn't be used publicly.
15593 // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
15595 if (this.prerelease.length === 0) {
15596 this.prerelease = [0]
15598 let i = this.prerelease.length
15600 if (typeof this.prerelease[i] === 'number') {
15601 this.prerelease[i]++
15606 // didn't increment anything
15607 this.prerelease.push(0)
15611 // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
15612 // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
15613 if (this.prerelease[0] === identifier) {
15614 if (isNaN(this.prerelease[1])) {
15615 this.prerelease = [identifier, 0]
15618 this.prerelease = [identifier, 0]
15624 throw new Error(`invalid increment argument: ${release}`)
15627 this.raw = this.version
15632 module.exports = SemVer
15637 /***/ ((module) => {
15639 const numeric = /^[0-9]+$/
15640 const compareIdentifiers = (a, b) => {
15641 const anum = numeric.test(a)
15642 const bnum = numeric.test(b)
15644 if (anum && bnum) {
15650 : (anum && !bnum) ? -1
15651 : (bnum && !anum) ? 1
15656 const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
15659 compareIdentifiers,
15660 rcompareIdentifiers
15666 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15668 const {MAX_LENGTH} = __webpack_require__(77)
15669 const { re, t } = __webpack_require__(76)
15670 const SemVer = __webpack_require__(79)
15672 const parse = (version, options) => {
15673 if (!options || typeof options !== 'object') {
15676 includePrerelease: false
15680 if (version instanceof SemVer) {
15684 if (typeof version !== 'string') {
15688 if (version.length > MAX_LENGTH) {
15692 const r = options.loose ? re[t.LOOSE] : re[t.FULL]
15693 if (!r.test(version)) {
15698 return new SemVer(version, options)
15704 module.exports = parse
15709 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15711 const parse = __webpack_require__(81)
15712 const valid = (version, options) => {
15713 const v = parse(version, options)
15714 return v ? v.version : null
15716 module.exports = valid
15721 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15723 const parse = __webpack_require__(81)
15724 const clean = (version, options) => {
15725 const s = parse(version.trim().replace(/^[=v]+/, ''), options)
15726 return s ? s.version : null
15728 module.exports = clean
15733 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15735 const SemVer = __webpack_require__(79)
15737 const inc = (version, release, options, identifier) => {
15738 if (typeof (options) === 'string') {
15739 identifier = options
15740 options = undefined
15744 return new SemVer(version, options).inc(release, identifier).version
15749 module.exports = inc
15754 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15756 const parse = __webpack_require__(81)
15757 const eq = __webpack_require__(86)
15759 const diff = (version1, version2) => {
15760 if (eq(version1, version2)) {
15763 const v1 = parse(version1)
15764 const v2 = parse(version2)
15765 const hasPre = v1.prerelease.length || v2.prerelease.length
15766 const prefix = hasPre ? 'pre' : ''
15767 const defaultResult = hasPre ? 'prerelease' : ''
15768 for (const key in v1) {
15769 if (key === 'major' || key === 'minor' || key === 'patch') {
15770 if (v1[key] !== v2[key]) {
15771 return prefix + key
15775 return defaultResult // may be undefined
15778 module.exports = diff
15783 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15785 const compare = __webpack_require__(87)
15786 const eq = (a, b, loose) => compare(a, b, loose) === 0
15787 module.exports = eq
15792 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15794 const SemVer = __webpack_require__(79)
15795 const compare = (a, b, loose) =>
15796 new SemVer(a, loose).compare(new SemVer(b, loose))
15798 module.exports = compare
15803 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15805 const SemVer = __webpack_require__(79)
15806 const major = (a, loose) => new SemVer(a, loose).major
15807 module.exports = major
15812 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15814 const SemVer = __webpack_require__(79)
15815 const minor = (a, loose) => new SemVer(a, loose).minor
15816 module.exports = minor
15821 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15823 const SemVer = __webpack_require__(79)
15824 const patch = (a, loose) => new SemVer(a, loose).patch
15825 module.exports = patch
15830 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15832 const parse = __webpack_require__(81)
15833 const prerelease = (version, options) => {
15834 const parsed = parse(version, options)
15835 return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
15837 module.exports = prerelease
15842 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15844 const compare = __webpack_require__(87)
15845 const rcompare = (a, b, loose) => compare(b, a, loose)
15846 module.exports = rcompare
15851 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15853 const compare = __webpack_require__(87)
15854 const compareLoose = (a, b) => compare(a, b, true)
15855 module.exports = compareLoose
15860 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15862 const SemVer = __webpack_require__(79)
15863 const compareBuild = (a, b, loose) => {
15864 const versionA = new SemVer(a, loose)
15865 const versionB = new SemVer(b, loose)
15866 return versionA.compare(versionB) || versionA.compareBuild(versionB)
15868 module.exports = compareBuild
15873 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15875 const compareBuild = __webpack_require__(94)
15876 const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
15877 module.exports = sort
15882 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15884 const compareBuild = __webpack_require__(94)
15885 const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
15886 module.exports = rsort
15891 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15893 const compare = __webpack_require__(87)
15894 const gt = (a, b, loose) => compare(a, b, loose) > 0
15895 module.exports = gt
15900 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15902 const compare = __webpack_require__(87)
15903 const lt = (a, b, loose) => compare(a, b, loose) < 0
15904 module.exports = lt
15909 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15911 const compare = __webpack_require__(87)
15912 const neq = (a, b, loose) => compare(a, b, loose) !== 0
15913 module.exports = neq
15918 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15920 const compare = __webpack_require__(87)
15921 const gte = (a, b, loose) => compare(a, b, loose) >= 0
15922 module.exports = gte
15927 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15929 const compare = __webpack_require__(87)
15930 const lte = (a, b, loose) => compare(a, b, loose) <= 0
15931 module.exports = lte
15936 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15938 const eq = __webpack_require__(86)
15939 const neq = __webpack_require__(99)
15940 const gt = __webpack_require__(97)
15941 const gte = __webpack_require__(100)
15942 const lt = __webpack_require__(98)
15943 const lte = __webpack_require__(101)
15945 const cmp = (a, op, b, loose) => {
15948 if (typeof a === 'object')
15950 if (typeof b === 'object')
15955 if (typeof a === 'object')
15957 if (typeof b === 'object')
15964 return eq(a, b, loose)
15967 return neq(a, b, loose)
15970 return gt(a, b, loose)
15973 return gte(a, b, loose)
15976 return lt(a, b, loose)
15979 return lte(a, b, loose)
15982 throw new TypeError(`Invalid operator: ${op}`)
15985 module.exports = cmp
15990 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15992 const SemVer = __webpack_require__(79)
15993 const parse = __webpack_require__(81)
15994 const {re, t} = __webpack_require__(76)
15996 const coerce = (version, options) => {
15997 if (version instanceof SemVer) {
16001 if (typeof version === 'number') {
16002 version = String(version)
16005 if (typeof version !== 'string') {
16009 options = options || {}
16012 if (!options.rtl) {
16013 match = version.match(re[t.COERCE])
16015 // Find the right-most coercible string that does not share
16016 // a terminus with a more left-ward coercible string.
16017 // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
16019 // Walk through the string checking with a /g regexp
16020 // Manually set the index so as to pick up overlapping matches.
16021 // Stop when we get a match that ends at the string end, since no
16022 // coercible string can be more right-ward without the same terminus.
16024 while ((next = re[t.COERCERTL].exec(version)) &&
16025 (!match || match.index + match[0].length !== version.length)
16028 next.index + next[0].length !== match.index + match[0].length) {
16031 re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
16033 // leave it in a clean state
16034 re[t.COERCERTL].lastIndex = -1
16037 if (match === null)
16040 return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
16042 module.exports = coerce
16047 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16049 const ANY = Symbol('SemVer ANY')
16050 // hoisted class for cyclic dependency
16052 static get ANY () {
16055 constructor (comp, options) {
16056 if (!options || typeof options !== 'object') {
16059 includePrerelease: false
16063 if (comp instanceof Comparator) {
16064 if (comp.loose === !!options.loose) {
16071 debug('comparator', comp, options)
16072 this.options = options
16073 this.loose = !!options.loose
16076 if (this.semver === ANY) {
16079 this.value = this.operator + this.semver.version
16082 debug('comp', this)
16086 const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
16087 const m = comp.match(r)
16090 throw new TypeError(`Invalid comparator: ${comp}`)
16093 this.operator = m[1] !== undefined ? m[1] : ''
16094 if (this.operator === '=') {
16098 // if it literally is just '>' or '' then allow anything.
16102 this.semver = new SemVer(m[2], this.options.loose)
16111 debug('Comparator.test', version, this.options.loose)
16113 if (this.semver === ANY || version === ANY) {
16117 if (typeof version === 'string') {
16119 version = new SemVer(version, this.options)
16125 return cmp(version, this.operator, this.semver, this.options)
16128 intersects (comp, options) {
16129 if (!(comp instanceof Comparator)) {
16130 throw new TypeError('a Comparator is required')
16133 if (!options || typeof options !== 'object') {
16136 includePrerelease: false
16140 if (this.operator === '') {
16141 if (this.value === '') {
16144 return new Range(comp.value, options).test(this.value)
16145 } else if (comp.operator === '') {
16146 if (comp.value === '') {
16149 return new Range(this.value, options).test(comp.semver)
16152 const sameDirectionIncreasing =
16153 (this.operator === '>=' || this.operator === '>') &&
16154 (comp.operator === '>=' || comp.operator === '>')
16155 const sameDirectionDecreasing =
16156 (this.operator === '<=' || this.operator === '<') &&
16157 (comp.operator === '<=' || comp.operator === '<')
16158 const sameSemVer = this.semver.version === comp.semver.version
16159 const differentDirectionsInclusive =
16160 (this.operator === '>=' || this.operator === '<=') &&
16161 (comp.operator === '>=' || comp.operator === '<=')
16162 const oppositeDirectionsLessThan =
16163 cmp(this.semver, '<', comp.semver, options) &&
16164 (this.operator === '>=' || this.operator === '>') &&
16165 (comp.operator === '<=' || comp.operator === '<')
16166 const oppositeDirectionsGreaterThan =
16167 cmp(this.semver, '>', comp.semver, options) &&
16168 (this.operator === '<=' || this.operator === '<') &&
16169 (comp.operator === '>=' || comp.operator === '>')
16172 sameDirectionIncreasing ||
16173 sameDirectionDecreasing ||
16174 (sameSemVer && differentDirectionsInclusive) ||
16175 oppositeDirectionsLessThan ||
16176 oppositeDirectionsGreaterThan
16181 module.exports = Comparator
16183 const {re, t} = __webpack_require__(76)
16184 const cmp = __webpack_require__(102)
16185 const debug = __webpack_require__(78)
16186 const SemVer = __webpack_require__(79)
16187 const Range = __webpack_require__(105)
16192 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16194 // hoisted class for cyclic dependency
16196 constructor (range, options) {
16197 if (!options || typeof options !== 'object') {
16200 includePrerelease: false
16204 if (range instanceof Range) {
16206 range.loose === !!options.loose &&
16207 range.includePrerelease === !!options.includePrerelease
16211 return new Range(range.raw, options)
16215 if (range instanceof Comparator) {
16216 // just put it in the set and return
16217 this.raw = range.value
16218 this.set = [[range]]
16223 this.options = options
16224 this.loose = !!options.loose
16225 this.includePrerelease = !!options.includePrerelease
16227 // First, split based on boolean or ||
16230 .split(/\s*\|\|\s*/)
16231 // map the range to a 2d array of comparators
16232 .map(range => this.parseRange(range.trim()))
16233 // throw out any comparator lists that are empty
16234 // this generally means that it was not a valid range, which is allowed
16235 // in loose mode, but will still throw if the WHOLE range is invalid.
16236 .filter(c => c.length)
16238 if (!this.set.length) {
16239 throw new TypeError(`Invalid SemVer Range: ${range}`)
16246 this.range = this.set
16248 return comps.join(' ').trim()
16259 parseRange (range) {
16260 const loose = this.options.loose
16261 range = range.trim()
16262 // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
16263 const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
16264 range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
16265 debug('hyphen replace', range)
16266 // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
16267 range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
16268 debug('comparator trim', range, re[t.COMPARATORTRIM])
16270 // `~ 1.2.3` => `~1.2.3`
16271 range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
16273 // `^ 1.2.3` => `^1.2.3`
16274 range = range.replace(re[t.CARETTRIM], caretTrimReplace)
16276 // normalize spaces
16277 range = range.split(/\s+/).join(' ')
16279 // At this point, the range is completely trimmed and
16280 // ready to be split into comparators.
16282 const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
16285 .map(comp => parseComparator(comp, this.options))
16288 .map(comp => replaceGTE0(comp, this.options))
16289 // in loose mode, throw out any that are not valid comparators
16290 .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
16291 .map(comp => new Comparator(comp, this.options))
16294 intersects (range, options) {
16295 if (!(range instanceof Range)) {
16296 throw new TypeError('a Range is required')
16299 return this.set.some((thisComparators) => {
16301 isSatisfiable(thisComparators, options) &&
16302 range.set.some((rangeComparators) => {
16304 isSatisfiable(rangeComparators, options) &&
16305 thisComparators.every((thisComparator) => {
16306 return rangeComparators.every((rangeComparator) => {
16307 return thisComparator.intersects(rangeComparator, options)
16316 // if ANY of the sets match ALL of its comparators, then pass
16322 if (typeof version === 'string') {
16324 version = new SemVer(version, this.options)
16330 for (let i = 0; i < this.set.length; i++) {
16331 if (testSet(this.set[i], version, this.options)) {
16338 module.exports = Range
16340 const Comparator = __webpack_require__(104)
16341 const debug = __webpack_require__(78)
16342 const SemVer = __webpack_require__(79)
16346 comparatorTrimReplace,
16349 } = __webpack_require__(76)
16351 // take a set of comparators and determine whether there
16352 // exists a version which can satisfy it
16353 const isSatisfiable = (comparators, options) => {
16355 const remainingComparators = comparators.slice()
16356 let testComparator = remainingComparators.pop()
16358 while (result && remainingComparators.length) {
16359 result = remainingComparators.every((otherComparator) => {
16360 return testComparator.intersects(otherComparator, options)
16363 testComparator = remainingComparators.pop()
16369 // comprised of xranges, tildes, stars, and gtlt's at this point.
16370 // already replaced the hyphen ranges
16371 // turn into a set of JUST comparators.
16372 const parseComparator = (comp, options) => {
16373 debug('comp', comp, options)
16374 comp = replaceCarets(comp, options)
16375 debug('caret', comp)
16376 comp = replaceTildes(comp, options)
16377 debug('tildes', comp)
16378 comp = replaceXRanges(comp, options)
16379 debug('xrange', comp)
16380 comp = replaceStars(comp, options)
16381 debug('stars', comp)
16385 const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
16387 // ~, ~> --> * (any, kinda silly)
16388 // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
16389 // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
16390 // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
16391 // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
16392 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
16393 const replaceTildes = (comp, options) =>
16394 comp.trim().split(/\s+/).map((comp) => {
16395 return replaceTilde(comp, options)
16398 const replaceTilde = (comp, options) => {
16399 const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
16400 return comp.replace(r, (_, M, m, p, pr) => {
16401 debug('tilde', comp, _, M, m, p, pr)
16406 } else if (isX(m)) {
16407 ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
16408 } else if (isX(p)) {
16409 // ~1.2 == >=1.2.0 <1.3.0-0
16410 ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
16412 debug('replaceTilde pr', pr)
16413 ret = `>=${M}.${m}.${p}-${pr
16414 } <${M}.${+m + 1}.0-0`
16416 // ~1.2.3 == >=1.2.3 <1.3.0-0
16417 ret = `>=${M}.${m}.${p
16418 } <${M}.${+m + 1}.0-0`
16421 debug('tilde return', ret)
16426 // ^ --> * (any, kinda silly)
16427 // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
16428 // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
16429 // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
16430 // ^1.2.3 --> >=1.2.3 <2.0.0-0
16431 // ^1.2.0 --> >=1.2.0 <2.0.0-0
16432 const replaceCarets = (comp, options) =>
16433 comp.trim().split(/\s+/).map((comp) => {
16434 return replaceCaret(comp, options)
16437 const replaceCaret = (comp, options) => {
16438 debug('caret', comp, options)
16439 const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
16440 const z = options.includePrerelease ? '-0' : ''
16441 return comp.replace(r, (_, M, m, p, pr) => {
16442 debug('caret', comp, _, M, m, p, pr)
16447 } else if (isX(m)) {
16448 ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
16449 } else if (isX(p)) {
16451 ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
16453 ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
16456 debug('replaceCaret pr', pr)
16459 ret = `>=${M}.${m}.${p}-${pr
16460 } <${M}.${m}.${+p + 1}-0`
16462 ret = `>=${M}.${m}.${p}-${pr
16463 } <${M}.${+m + 1}.0-0`
16466 ret = `>=${M}.${m}.${p}-${pr
16467 } <${+M + 1}.0.0-0`
16473 ret = `>=${M}.${m}.${p
16474 }${z} <${M}.${m}.${+p + 1}-0`
16476 ret = `>=${M}.${m}.${p
16477 }${z} <${M}.${+m + 1}.0-0`
16480 ret = `>=${M}.${m}.${p
16481 } <${+M + 1}.0.0-0`
16485 debug('caret return', ret)
16490 const replaceXRanges = (comp, options) => {
16491 debug('replaceXRanges', comp, options)
16492 return comp.split(/\s+/).map((comp) => {
16493 return replaceXRange(comp, options)
16497 const replaceXRange = (comp, options) => {
16499 const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
16500 return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
16501 debug('xRange', comp, ret, gtlt, M, m, p, pr)
16503 const xm = xM || isX(m)
16504 const xp = xm || isX(p)
16507 if (gtlt === '=' && anyX) {
16511 // if we're including prereleases in the match, then we need
16512 // to fix this to -0, the lowest possible prerelease value
16513 pr = options.includePrerelease ? '-0' : ''
16516 if (gtlt === '>' || gtlt === '<') {
16517 // nothing is allowed
16520 // nothing is forbidden
16523 } else if (gtlt && anyX) {
16524 // we know patch is an x, because we have any x at all.
16525 // replace X with 0
16531 if (gtlt === '>') {
16543 } else if (gtlt === '<=') {
16544 // <=0.7.x is actually <0.8.0, since any 0.7.x should
16545 // pass. Similarly, <=7.x is actually <8.0.0, etc.
16557 ret = `${gtlt + M}.${m}.${p}${pr}`
16559 ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
16561 ret = `>=${M}.${m}.0${pr
16562 } <${M}.${+m + 1}.0-0`
16565 debug('xRange return', ret)
16571 // Because * is AND-ed with everything else in the comparator,
16572 // and '' means "any version", just remove the *s entirely.
16573 const replaceStars = (comp, options) => {
16574 debug('replaceStars', comp, options)
16575 // Looseness is ignored here. star is always as loose as it gets!
16576 return comp.trim().replace(re[t.STAR], '')
16579 const replaceGTE0 = (comp, options) => {
16580 debug('replaceGTE0', comp, options)
16582 .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
16585 // This function is passed to string.replace(re[t.HYPHENRANGE])
16586 // M, m, patch, prerelease, build
16587 // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
16588 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
16589 // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
16590 const hyphenReplace = incPr => ($0,
16591 from, fM, fm, fp, fpr, fb,
16592 to, tM, tm, tp, tpr, tb) => {
16595 } else if (isX(fm)) {
16596 from = `>=${fM}.0.0${incPr ? '-0' : ''}`
16597 } else if (isX(fp)) {
16598 from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
16602 from = `>=${from}${incPr ? '-0' : ''}`
16607 } else if (isX(tm)) {
16608 to = `<${+tM + 1}.0.0-0`
16609 } else if (isX(tp)) {
16610 to = `<${tM}.${+tm + 1}.0-0`
16612 to = `<=${tM}.${tm}.${tp}-${tpr}`
16613 } else if (incPr) {
16614 to = `<${tM}.${tm}.${+tp + 1}-0`
16619 return (`${from} ${to}`).trim()
16622 const testSet = (set, version, options) => {
16623 for (let i = 0; i < set.length; i++) {
16624 if (!set[i].test(version)) {
16629 if (version.prerelease.length && !options.includePrerelease) {
16630 // Find the set of versions that are allowed to have prereleases
16631 // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
16632 // That should allow `1.2.3-pr.2` to pass.
16633 // However, `1.2.4-alpha.notready` should NOT be allowed,
16634 // even though it's within the range set by the comparators.
16635 for (let i = 0; i < set.length; i++) {
16636 debug(set[i].semver)
16637 if (set[i].semver === Comparator.ANY) {
16641 if (set[i].semver.prerelease.length > 0) {
16642 const allowed = set[i].semver
16643 if (allowed.major === version.major &&
16644 allowed.minor === version.minor &&
16645 allowed.patch === version.patch) {
16651 // Version has a -pre, but it's not one of the ones we like.
16661 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16663 const Range = __webpack_require__(105)
16664 const satisfies = (version, range, options) => {
16666 range = new Range(range, options)
16670 return range.test(version)
16672 module.exports = satisfies
16677 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16679 const Range = __webpack_require__(105)
16681 // Mostly just for testing and legacy API reasons
16682 const toComparators = (range, options) =>
16683 new Range(range, options).set
16684 .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
16686 module.exports = toComparators
16691 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16693 const SemVer = __webpack_require__(79)
16694 const Range = __webpack_require__(105)
16696 const maxSatisfying = (versions, range, options) => {
16699 let rangeObj = null
16701 rangeObj = new Range(range, options)
16705 versions.forEach((v) => {
16706 if (rangeObj.test(v)) {
16707 // satisfies(v, range, options)
16708 if (!max || maxSV.compare(v) === -1) {
16709 // compare(max, v, true)
16711 maxSV = new SemVer(max, options)
16717 module.exports = maxSatisfying
16722 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16724 const SemVer = __webpack_require__(79)
16725 const Range = __webpack_require__(105)
16726 const minSatisfying = (versions, range, options) => {
16729 let rangeObj = null
16731 rangeObj = new Range(range, options)
16735 versions.forEach((v) => {
16736 if (rangeObj.test(v)) {
16737 // satisfies(v, range, options)
16738 if (!min || minSV.compare(v) === 1) {
16739 // compare(min, v, true)
16741 minSV = new SemVer(min, options)
16747 module.exports = minSatisfying
16752 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16754 const SemVer = __webpack_require__(79)
16755 const Range = __webpack_require__(105)
16756 const gt = __webpack_require__(97)
16758 const minVersion = (range, loose) => {
16759 range = new Range(range, loose)
16761 let minver = new SemVer('0.0.0')
16762 if (range.test(minver)) {
16766 minver = new SemVer('0.0.0-0')
16767 if (range.test(minver)) {
16772 for (let i = 0; i < range.set.length; ++i) {
16773 const comparators = range.set[i]
16775 comparators.forEach((comparator) => {
16776 // Clone to avoid manipulating the comparator's semver object.
16777 const compver = new SemVer(comparator.semver.version)
16778 switch (comparator.operator) {
16780 if (compver.prerelease.length === 0) {
16783 compver.prerelease.push(0)
16785 compver.raw = compver.format()
16789 if (!minver || gt(minver, compver)) {
16795 /* Ignore maximum versions */
16797 /* istanbul ignore next */
16799 throw new Error(`Unexpected operation: ${comparator.operator}`)
16804 if (minver && range.test(minver)) {
16810 module.exports = minVersion
16815 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16817 const Range = __webpack_require__(105)
16818 const validRange = (range, options) => {
16820 // Return '*' instead of '' so that truthiness works.
16821 // This will throw if it's invalid anyway
16822 return new Range(range, options).range || '*'
16827 module.exports = validRange
16832 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16834 const SemVer = __webpack_require__(79)
16835 const Comparator = __webpack_require__(104)
16836 const {ANY} = Comparator
16837 const Range = __webpack_require__(105)
16838 const satisfies = __webpack_require__(106)
16839 const gt = __webpack_require__(97)
16840 const lt = __webpack_require__(98)
16841 const lte = __webpack_require__(101)
16842 const gte = __webpack_require__(100)
16844 const outside = (version, range, hilo, options) => {
16845 version = new SemVer(version, options)
16846 range = new Range(range, options)
16848 let gtfn, ltefn, ltfn, comp, ecomp
16865 throw new TypeError('Must provide a hilo val of "<" or ">"')
16868 // If it satisifes the range it is not outside
16869 if (satisfies(version, range, options)) {
16873 // From now on, variable terms are as if we're in "gtr" mode.
16874 // but note that everything is flipped for the "ltr" function.
16876 for (let i = 0; i < range.set.length; ++i) {
16877 const comparators = range.set[i]
16882 comparators.forEach((comparator) => {
16883 if (comparator.semver === ANY) {
16884 comparator = new Comparator('>=0.0.0')
16886 high = high || comparator
16887 low = low || comparator
16888 if (gtfn(comparator.semver, high.semver, options)) {
16890 } else if (ltfn(comparator.semver, low.semver, options)) {
16895 // If the edge version comparator has a operator then our version
16896 // isn't outside it
16897 if (high.operator === comp || high.operator === ecomp) {
16901 // If the lowest version comparator has an operator and our version
16902 // is less than it then it isn't higher than the range
16903 if ((!low.operator || low.operator === comp) &&
16904 ltefn(version, low.semver)) {
16906 } else if (low.operator === ecomp && ltfn(version, low.semver)) {
16913 module.exports = outside
16918 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16920 // Determine if version is greater than all the versions possible in the range.
16921 const outside = __webpack_require__(112)
16922 const gtr = (version, range, options) => outside(version, range, '>', options)
16923 module.exports = gtr
16928 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16930 const outside = __webpack_require__(112)
16931 // Determine if version is less than all the versions possible in the range
16932 const ltr = (version, range, options) => outside(version, range, '<', options)
16933 module.exports = ltr
16938 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16940 const Range = __webpack_require__(105)
16941 const intersects = (r1, r2, options) => {
16942 r1 = new Range(r1, options)
16943 r2 = new Range(r2, options)
16944 return r1.intersects(r2)
16946 module.exports = intersects
16951 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
16953 // given a set of versions and a range, create a "simplified" range
16954 // that includes the same versions that the original range does
16955 // If the original range is shorter than the simplified one, return that.
16956 const satisfies = __webpack_require__(106)
16957 const compare = __webpack_require__(87)
16958 module.exports = (versions, range, options) => {
16962 const v = versions.sort((a, b) => compare(a, b, options))
16963 for (const version of v) {
16964 const included = satisfies(version, range, options)
16971 set.push([min, prev])
16978 set.push([min, null])
16981 for (const [min, max] of set) {
16984 else if (!max && min === v[0])
16987 ranges.push(`>=${min}`)
16988 else if (min === v[0])
16989 ranges.push(`<=${max}`)
16991 ranges.push(`${min} - ${max}`)
16993 const simplified = ranges.join(' || ')
16994 const original = typeof range.raw === 'string' ? range.raw : String(range)
16995 return simplified.length < original.length ? simplified : range
17001 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17003 const Range = __webpack_require__(105)
17004 const { ANY } = __webpack_require__(104)
17005 const satisfies = __webpack_require__(106)
17006 const compare = __webpack_require__(87)
17008 // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
17009 // - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...`
17011 // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
17012 // - If c is only the ANY comparator
17013 // - If C is only the ANY comparator, return true
17014 // - Else return false
17015 // - Let EQ be the set of = comparators in c
17016 // - If EQ is more than one, return true (null set)
17017 // - Let GT be the highest > or >= comparator in c
17018 // - Let LT be the lowest < or <= comparator in c
17019 // - If GT and LT, and GT.semver > LT.semver, return true (null set)
17021 // - If GT, and EQ does not satisfy GT, return true (null set)
17022 // - If LT, and EQ does not satisfy LT, return true (null set)
17023 // - If EQ satisfies every C, return true
17024 // - Else return false
17026 // - If GT is lower than any > or >= comp in C, return false
17027 // - If GT is >=, and GT.semver does not satisfy every C, return false
17029 // - If LT.semver is greater than that of any > comp in C, return false
17030 // - If LT is <=, and LT.semver does not satisfy every C, return false
17031 // - If any C is a = range, and GT or LT are set, return false
17032 // - Else return true
17034 const subset = (sub, dom, options) => {
17035 sub = new Range(sub, options)
17036 dom = new Range(dom, options)
17037 let sawNonNull = false
17039 OUTER: for (const simpleSub of sub.set) {
17040 for (const simpleDom of dom.set) {
17041 const isSub = simpleSubset(simpleSub, simpleDom, options)
17042 sawNonNull = sawNonNull || isSub !== null
17046 // the null set is a subset of everything, but null simple ranges in
17047 // a complex range should be ignored. so if we saw a non-null range,
17048 // then we know this isn't a subset, but if EVERY simple range was null,
17049 // then it is a subset.
17056 const simpleSubset = (sub, dom, options) => {
17057 if (sub.length === 1 && sub[0].semver === ANY)
17058 return dom.length === 1 && dom[0].semver === ANY
17060 const eqSet = new Set()
17062 for (const c of sub) {
17063 if (c.operator === '>' || c.operator === '>=')
17064 gt = higherGT(gt, c, options)
17065 else if (c.operator === '<' || c.operator === '<=')
17066 lt = lowerLT(lt, c, options)
17068 eqSet.add(c.semver)
17071 if (eqSet.size > 1)
17076 gtltComp = compare(gt.semver, lt.semver, options)
17079 else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
17083 // will iterate one or zero times
17084 for (const eq of eqSet) {
17085 if (gt && !satisfies(eq, String(gt), options))
17088 if (lt && !satisfies(eq, String(lt), options))
17091 for (const c of dom) {
17092 if (!satisfies(eq, String(c), options))
17099 let hasDomLT, hasDomGT
17100 for (const c of dom) {
17101 hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
17102 hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
17104 if (c.operator === '>' || c.operator === '>=') {
17105 higher = higherGT(gt, c, options)
17108 } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options))
17112 if (c.operator === '<' || c.operator === '<=') {
17113 lower = lowerLT(lt, c, options)
17116 } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options))
17119 if (!c.operator && (lt || gt) && gtltComp !== 0)
17123 // if there was a < or >, and nothing in the dom, then must be false
17124 // UNLESS it was limited by another range in the other direction.
17125 // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
17126 if (gt && hasDomLT && !lt && gtltComp !== 0)
17129 if (lt && hasDomGT && !gt && gtltComp !== 0)
17135 // >=1.2.3 is lower than >1.2.3
17136 const higherGT = (a, b, options) => {
17139 const comp = compare(a.semver, b.semver, options)
17140 return comp > 0 ? a
17142 : b.operator === '>' && a.operator === '>=' ? b
17146 // <=1.2.3 is higher than <1.2.3
17147 const lowerLT = (a, b, options) => {
17150 const comp = compare(a.semver, b.semver, options)
17151 return comp < 0 ? a
17153 : b.operator === '<' && a.operator === '<=' ? b
17157 module.exports = subset
17162 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
17166 // Polyfills for node 0.8
17167 __webpack_require__(119);
17168 __webpack_require__(120);
17169 __webpack_require__(121);
17172 exports.Parse = __webpack_require__(122);
17173 exports.ParseOne = __webpack_require__(186);
17174 exports.Extract = __webpack_require__(188);
17175 exports.Open = __webpack_require__(211);
17179 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17184 var listenerCount = __webpack_require__(68).listenerCount
17185 // listenerCount isn't in node 0.10, so here's a basic polyfill
17186 listenerCount = listenerCount || function (ee, event) {
17187 var listeners = ee && ee._events && ee._events[event]
17188 if (Array.isArray(listeners)) {
17189 return listeners.length
17190 } else if (typeof listeners === 'function') {
17197 module.exports = listenerCount
17207 if (!Buffer.prototype.indexOf) {
17208 Buffer.prototype.indexOf = function (value, offset) {
17209 offset = offset || 0;
17211 // Always wrap the input as a Buffer so that this method will support any
17212 // data type such as array octet, string or buffer.
17213 if (typeof value === "string" || value instanceof String) {
17214 value = new Buffer(value);
17215 } else if (typeof value === "number" || value instanceof Number) {
17216 value = new Buffer([ value ]);
17219 var len = value.length;
17221 for (var i = offset; i <= this.length - len; i++) {
17222 var mismatch = false;
17223 for (var j = 0; j < len; j++) {
17224 if (this[i + j] != value[j]) {
17239 function bufferLastIndexOf (value, offset) {
17241 // Always wrap the input as a Buffer so that this method will support any
17242 // data type such as array octet, string or buffer.
17243 if (typeof value === "string" || value instanceof String) {
17244 value = new Buffer(value);
17245 } else if (typeof value === "number" || value instanceof Number) {
17246 value = new Buffer([ value ]);
17249 var len = value.length;
17250 offset = offset || this.length - len;
17252 for (var i = offset; i >= 0; i--) {
17253 var mismatch = false;
17254 for (var j = 0; j < len; j++) {
17255 if (this[i + j] != value[j]) {
17270 if (Buffer.prototype.lastIndexOf) {
17271 // check Buffer#lastIndexOf is usable: https://github.com/nodejs/node/issues/4604
17272 if (new Buffer ("ABC").lastIndexOf ("ABC") === -1)
17273 Buffer.prototype.lastIndexOf = bufferLastIndexOf;
17275 Buffer.prototype.lastIndexOf = bufferLastIndexOf;
17281 /***/ (function() {
17283 (function (global, undefined) {
17286 if (global.setImmediate) {
17290 var nextHandle = 1; // Spec says greater than zero
17291 var tasksByHandle = {};
17292 var currentlyRunningATask = false;
17293 var doc = global.document;
17294 var registerImmediate;
17296 function setImmediate(callback) {
17297 // Callback can either be a function or a string
17298 if (typeof callback !== "function") {
17299 callback = new Function("" + callback);
17301 // Copy function arguments
17302 var args = new Array(arguments.length - 1);
17303 for (var i = 0; i < args.length; i++) {
17304 args[i] = arguments[i + 1];
17306 // Store and register the task
17307 var task = { callback: callback, args: args };
17308 tasksByHandle[nextHandle] = task;
17309 registerImmediate(nextHandle);
17310 return nextHandle++;
17313 function clearImmediate(handle) {
17314 delete tasksByHandle[handle];
17317 function run(task) {
17318 var callback = task.callback;
17319 var args = task.args;
17320 switch (args.length) {
17328 callback(args[0], args[1]);
17331 callback(args[0], args[1], args[2]);
17334 callback.apply(undefined, args);
17339 function runIfPresent(handle) {
17340 // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
17341 // So if we're currently running a task, we'll need to delay this invocation.
17342 if (currentlyRunningATask) {
17343 // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
17344 // "too much recursion" error.
17345 setTimeout(runIfPresent, 0, handle);
17347 var task = tasksByHandle[handle];
17349 currentlyRunningATask = true;
17353 clearImmediate(handle);
17354 currentlyRunningATask = false;
17360 function installNextTickImplementation() {
17361 registerImmediate = function(handle) {
17362 process.nextTick(function () { runIfPresent(handle); });
17366 function canUsePostMessage() {
17367 // The test against `importScripts` prevents this implementation from being installed inside a web worker,
17368 // where `global.postMessage` means something completely different and can't be used for this purpose.
17369 if (global.postMessage && !global.importScripts) {
17370 var postMessageIsAsynchronous = true;
17371 var oldOnMessage = global.onmessage;
17372 global.onmessage = function() {
17373 postMessageIsAsynchronous = false;
17375 global.postMessage("", "*");
17376 global.onmessage = oldOnMessage;
17377 return postMessageIsAsynchronous;
17381 function installPostMessageImplementation() {
17382 // Installs an event handler on `global` for the `message` event: see
17383 // * https://developer.mozilla.org/en/DOM/window.postMessage
17384 // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
17386 var messagePrefix = "setImmediate$" + Math.random() + "$";
17387 var onGlobalMessage = function(event) {
17388 if (event.source === global &&
17389 typeof event.data === "string" &&
17390 event.data.indexOf(messagePrefix) === 0) {
17391 runIfPresent(+event.data.slice(messagePrefix.length));
17395 if (global.addEventListener) {
17396 global.addEventListener("message", onGlobalMessage, false);
17398 global.attachEvent("onmessage", onGlobalMessage);
17401 registerImmediate = function(handle) {
17402 global.postMessage(messagePrefix + handle, "*");
17406 function installMessageChannelImplementation() {
17407 var channel = new MessageChannel();
17408 channel.port1.onmessage = function(event) {
17409 var handle = event.data;
17410 runIfPresent(handle);
17413 registerImmediate = function(handle) {
17414 channel.port2.postMessage(handle);
17418 function installReadyStateChangeImplementation() {
17419 var html = doc.documentElement;
17420 registerImmediate = function(handle) {
17421 // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
17422 // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
17423 var script = doc.createElement("script");
17424 script.onreadystatechange = function () {
17425 runIfPresent(handle);
17426 script.onreadystatechange = null;
17427 html.removeChild(script);
17430 html.appendChild(script);
17434 function installSetTimeoutImplementation() {
17435 registerImmediate = function(handle) {
17436 setTimeout(runIfPresent, 0, handle);
17440 // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
17441 var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
17442 attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
17444 // Don't get fooled by e.g. browserify environments.
17445 if ({}.toString.call(global.process) === "[object process]") {
17446 // For Node.js before 0.9
17447 installNextTickImplementation();
17449 } else if (canUsePostMessage()) {
17450 // For non-IE10 modern browsers
17451 installPostMessageImplementation();
17453 } else if (global.MessageChannel) {
17454 // For web workers, where supported
17455 installMessageChannelImplementation();
17457 } else if (doc && "onreadystatechange" in doc.createElement("script")) {
17459 installReadyStateChangeImplementation();
17462 // For older browsers
17463 installSetTimeoutImplementation();
17466 attachTo.setImmediate = setImmediate;
17467 attachTo.clearImmediate = clearImmediate;
17468 }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
17473 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
17475 var util = __webpack_require__(50);
17476 var zlib = __webpack_require__(48);
17477 var Stream = __webpack_require__(44);
17478 var binary = __webpack_require__(123);
17479 var Promise = __webpack_require__(128);
17480 var PullStream = __webpack_require__(164);
17481 var NoopStream = __webpack_require__(182);
17482 var BufferStream = __webpack_require__(183);
17483 var parseExtraField = __webpack_require__(184);
17484 var Buffer = __webpack_require__(165);
17485 var parseDateTime = __webpack_require__(185);
17487 // Backwards compatibility for node versions < 8
17488 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
17489 Stream = __webpack_require__(167);
17491 var endDirectorySignature = Buffer.alloc(4);
17492 endDirectorySignature.writeUInt32LE(0x06054b50, 0);
17494 function Parse(opts) {
17495 if (!(this instanceof Parse)) {
17496 return new Parse(opts);
17499 self._opts = opts || { verbose: false };
17501 PullStream.call(self, self._opts);
17502 self.on('finish',function() {
17503 self.emit('close');
17505 self._readRecord().catch(function(e) {
17506 if (!self.__emittedError || self.__emittedError !== e)
17507 self.emit('error',e);
17511 util.inherits(Parse, PullStream);
17513 Parse.prototype._readRecord = function () {
17515 return self.pull(4).then(function(data) {
17516 if (data.length === 0)
17519 var signature = data.readUInt32LE(0);
17521 if (signature === 0x34327243) {
17522 return self._readCrxHeader();
17524 if (signature === 0x04034b50) {
17525 return self._readFile();
17527 else if (signature === 0x02014b50) {
17528 self.__ended = true;
17529 return self._readCentralDirectoryFileHeader();
17531 else if (signature === 0x06054b50) {
17532 return self._readEndOfCentralDirectoryRecord();
17534 else if (self.__ended) {
17535 return self.pull(endDirectorySignature).then(function() {
17536 return self._readEndOfCentralDirectoryRecord();
17540 self.emit('error', new Error('invalid signature: 0x' + signature.toString(16)));
17544 Parse.prototype._readCrxHeader = function() {
17546 return self.pull(12).then(function(data) {
17547 self.crxHeader = binary.parse(data)
17548 .word32lu('version')
17549 .word32lu('pubKeyLength')
17550 .word32lu('signatureLength')
17552 return self.pull(self.crxHeader.pubKeyLength + self.crxHeader.signatureLength);
17553 }).then(function(data) {
17554 self.crxHeader.publicKey = data.slice(0,self.crxHeader.pubKeyLength);
17555 self.crxHeader.signature = data.slice(self.crxHeader.pubKeyLength);
17556 self.emit('crx-header',self.crxHeader);
17557 return self._readRecord();
17561 Parse.prototype._readFile = function () {
17563 return self.pull(26).then(function(data) {
17564 var vars = binary.parse(data)
17565 .word16lu('versionsNeededToExtract')
17567 .word16lu('compressionMethod')
17568 .word16lu('lastModifiedTime')
17569 .word16lu('lastModifiedDate')
17571 .word32lu('compressedSize')
17572 .word32lu('uncompressedSize')
17573 .word16lu('fileNameLength')
17574 .word16lu('extraFieldLength')
17577 vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
17579 if (self.crxHeader) vars.crxHeader = self.crxHeader;
17581 return self.pull(vars.fileNameLength).then(function(fileNameBuffer) {
17582 var fileName = fileNameBuffer.toString('utf8');
17583 var entry = Stream.PassThrough();
17584 var __autodraining = false;
17586 entry.autodrain = function() {
17587 __autodraining = true;
17588 var draining = entry.pipe(NoopStream());
17589 draining.promise = function() {
17590 return new Promise(function(resolve, reject) {
17591 draining.on('finish',resolve);
17592 draining.on('error',reject);
17598 entry.buffer = function() {
17599 return BufferStream(entry);
17602 entry.path = fileName;
17604 entry.props.path = fileName;
17605 entry.props.pathBuffer = fileNameBuffer;
17606 entry.props.flags = {
17607 "isUnicode": vars.flags & 0x11
17609 entry.type = (vars.uncompressedSize === 0 && /[\/\\]$/.test(fileName)) ? 'Directory' : 'File';
17611 if (self._opts.verbose) {
17612 if (entry.type === 'Directory') {
17613 console.log(' creating:', fileName);
17614 } else if (entry.type === 'File') {
17615 if (vars.compressionMethod === 0) {
17616 console.log(' extracting:', fileName);
17618 console.log(' inflating:', fileName);
17623 return self.pull(vars.extraFieldLength).then(function(extraField) {
17624 var extra = parseExtraField(extraField, vars);
17627 entry.extra = extra;
17629 if (self._opts.forceStream) {
17632 self.emit('entry', entry);
17634 if (self._readableState.pipesCount || (self._readableState.pipes && self._readableState.pipes.length))
17638 if (self._opts.verbose)
17645 var fileSizeKnown = !(vars.flags & 0x08) || vars.compressedSize > 0,
17648 entry.__autodraining = __autodraining; // expose __autodraining for test purposes
17649 var inflater = (vars.compressionMethod && !__autodraining) ? zlib.createInflateRaw() : Stream.PassThrough();
17651 if (fileSizeKnown) {
17652 entry.size = vars.uncompressedSize;
17653 eof = vars.compressedSize;
17655 eof = Buffer.alloc(4);
17656 eof.writeUInt32LE(0x08074b50, 0);
17659 return new Promise(function(resolve, reject) {
17662 .on('error',function(err) { self.emit('error',err);})
17664 .on('finish', function() {
17665 return fileSizeKnown ?
17666 self._readRecord().then(resolve).catch(reject) :
17667 self._processDataDescriptor(entry).then(resolve).catch(reject);
17675 Parse.prototype._processDataDescriptor = function (entry) {
17677 return self.pull(16).then(function(data) {
17678 var vars = binary.parse(data)
17679 .word32lu('dataDescriptorSignature')
17681 .word32lu('compressedSize')
17682 .word32lu('uncompressedSize')
17685 entry.size = vars.uncompressedSize;
17686 return self._readRecord();
17690 Parse.prototype._readCentralDirectoryFileHeader = function () {
17692 return self.pull(42).then(function(data) {
17694 var vars = binary.parse(data)
17695 .word16lu('versionMadeBy')
17696 .word16lu('versionsNeededToExtract')
17698 .word16lu('compressionMethod')
17699 .word16lu('lastModifiedTime')
17700 .word16lu('lastModifiedDate')
17702 .word32lu('compressedSize')
17703 .word32lu('uncompressedSize')
17704 .word16lu('fileNameLength')
17705 .word16lu('extraFieldLength')
17706 .word16lu('fileCommentLength')
17707 .word16lu('diskNumber')
17708 .word16lu('internalFileAttributes')
17709 .word32lu('externalFileAttributes')
17710 .word32lu('offsetToLocalFileHeader')
17713 return self.pull(vars.fileNameLength).then(function(fileName) {
17714 vars.fileName = fileName.toString('utf8');
17715 return self.pull(vars.extraFieldLength);
17717 .then(function(extraField) {
17718 return self.pull(vars.fileCommentLength);
17720 .then(function(fileComment) {
17721 return self._readRecord();
17726 Parse.prototype._readEndOfCentralDirectoryRecord = function() {
17728 return self.pull(18).then(function(data) {
17730 var vars = binary.parse(data)
17731 .word16lu('diskNumber')
17732 .word16lu('diskStart')
17733 .word16lu('numberOfRecordsOnDisk')
17734 .word16lu('numberOfRecords')
17735 .word32lu('sizeOfCentralDirectory')
17736 .word32lu('offsetToStartOfCentralDirectory')
17737 .word16lu('commentLength')
17740 return self.pull(vars.commentLength).then(function(comment) {
17741 comment = comment.toString('utf8');
17749 Parse.prototype.promise = function() {
17751 return new Promise(function(resolve,reject) {
17752 self.on('finish',resolve);
17753 self.on('error',reject);
17757 module.exports = Parse;
17762 /***/ ((module, exports, __webpack_require__) => {
17764 var Chainsaw = __webpack_require__(124);
17765 var EventEmitter = __webpack_require__(68).EventEmitter;
17766 var Buffers = __webpack_require__(126);
17767 var Vars = __webpack_require__(127);
17768 var Stream = __webpack_require__(44).Stream;
17770 exports = module.exports = function (bufOrEm, eventName) {
17771 if (Buffer.isBuffer(bufOrEm)) {
17772 return exports.parse(bufOrEm);
17775 var s = exports.stream();
17776 if (bufOrEm && bufOrEm.pipe) {
17779 else if (bufOrEm) {
17780 bufOrEm.on(eventName || 'data', function (buf) {
17784 bufOrEm.on('end', function () {
17791 exports.stream = function (input) {
17792 if (input) return exports.apply(null, arguments);
17794 var pending = null;
17795 function getBytes (bytes, cb, skip) {
17799 cb : function (buf) {
17808 function dispatch () {
17810 if (caughtEnd) done = true;
17813 if (typeof pending === 'function') {
17817 var bytes = offset + pending.bytes;
17819 if (buffers.length >= bytes) {
17821 if (offset == null) {
17822 buf = buffers.splice(0, bytes);
17823 if (!pending.skip) {
17828 if (!pending.skip) {
17829 buf = buffers.slice(offset, bytes);
17834 if (pending.skip) {
17844 function builder (saw) {
17845 function next () { if (!done) saw.next() }
17847 var self = words(function (bytes, cb) {
17848 return function (name) {
17849 getBytes(bytes, function (buf) {
17850 vars.set(name, cb(buf));
17856 self.tap = function (cb) {
17857 saw.nest(cb, vars.store);
17860 self.into = function (key, cb) {
17861 if (!vars.get(key)) vars.set(key, {});
17863 vars = Vars(parent.get(key));
17865 saw.nest(function () {
17866 cb.apply(this, arguments);
17867 this.tap(function () {
17873 self.flush = function () {
17878 self.loop = function (cb) {
17881 saw.nest(false, function loop () {
17882 this.vars = vars.store;
17883 cb.call(this, function () {
17887 this.tap(function () {
17888 if (end) saw.next()
17889 else loop.call(this)
17894 self.buffer = function (name, bytes) {
17895 if (typeof bytes === 'string') {
17896 bytes = vars.get(bytes);
17899 getBytes(bytes, function (buf) {
17900 vars.set(name, buf);
17905 self.skip = function (bytes) {
17906 if (typeof bytes === 'string') {
17907 bytes = vars.get(bytes);
17910 getBytes(bytes, function () {
17915 self.scan = function find (name, search) {
17916 if (typeof search === 'string') {
17917 search = new Buffer(search);
17919 else if (!Buffer.isBuffer(search)) {
17920 throw new Error('search must be a Buffer or a string');
17924 pending = function () {
17925 var pos = buffers.indexOf(search, offset + taken);
17926 var i = pos-offset-taken;
17929 if (offset != null) {
17932 buffers.slice(offset, offset + taken + i)
17934 offset += taken + i + search.length;
17939 buffers.slice(0, taken + i)
17941 buffers.splice(0, taken + i + search.length);
17946 i = Math.max(buffers.length - search.length - offset - taken, 0);
17953 self.peek = function (cb) {
17955 saw.nest(function () {
17956 cb.call(this, vars.store);
17957 this.tap(function () {
17966 var stream = Chainsaw.light(builder);
17967 stream.writable = true;
17969 var buffers = Buffers();
17971 stream.write = function (buf) {
17978 var done = false, caughtEnd = false;
17979 stream.end = function () {
17983 stream.pipe = Stream.prototype.pipe;
17984 Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function (name) {
17985 stream[name] = EventEmitter.prototype[name];
17991 exports.parse = function parse (buffer) {
17992 var self = words(function (bytes, cb) {
17993 return function (name) {
17994 if (offset + bytes <= buffer.length) {
17995 var buf = buffer.slice(offset, offset + bytes);
17997 vars.set(name, cb(buf));
18000 vars.set(name, null);
18008 self.vars = vars.store;
18010 self.tap = function (cb) {
18011 cb.call(self, vars.store);
18015 self.into = function (key, cb) {
18016 if (!vars.get(key)) {
18020 vars = Vars(parent.get(key));
18021 cb.call(self, vars.store);
18026 self.loop = function (cb) {
18028 var ender = function () { end = true };
18029 while (end === false) {
18030 cb.call(self, ender, vars.store);
18035 self.buffer = function (name, size) {
18036 if (typeof size === 'string') {
18037 size = vars.get(size);
18039 var buf = buffer.slice(offset, Math.min(buffer.length, offset + size));
18041 vars.set(name, buf);
18046 self.skip = function (bytes) {
18047 if (typeof bytes === 'string') {
18048 bytes = vars.get(bytes);
18055 self.scan = function (name, search) {
18056 if (typeof search === 'string') {
18057 search = new Buffer(search);
18059 else if (!Buffer.isBuffer(search)) {
18060 throw new Error('search must be a Buffer or a string');
18062 vars.set(name, null);
18064 // simple but slow string search
18065 for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) {
18068 j < search.length && buffer[offset+i+j] === search[j];
18071 if (j === search.length) break;
18074 vars.set(name, buffer.slice(offset, offset + i));
18075 offset += i + search.length;
18079 self.peek = function (cb) {
18081 cb.call(self, vars.store);
18086 self.flush = function () {
18091 self.eof = function () {
18092 return offset >= buffer.length;
18098 // convert byte strings to unsigned little endian numbers
18099 function decodeLEu (bytes) {
18101 for (var i = 0; i < bytes.length; i++) {
18102 acc += Math.pow(256,i) * bytes[i];
18107 // convert byte strings to unsigned big endian numbers
18108 function decodeBEu (bytes) {
18110 for (var i = 0; i < bytes.length; i++) {
18111 acc += Math.pow(256, bytes.length - i - 1) * bytes[i];
18116 // convert byte strings to signed big endian numbers
18117 function decodeBEs (bytes) {
18118 var val = decodeBEu(bytes);
18119 if ((bytes[0] & 0x80) == 0x80) {
18120 val -= Math.pow(256, bytes.length);
18125 // convert byte strings to signed little endian numbers
18126 function decodeLEs (bytes) {
18127 var val = decodeLEu(bytes);
18128 if ((bytes[bytes.length - 1] & 0x80) == 0x80) {
18129 val -= Math.pow(256, bytes.length);
18134 function words (decode) {
18137 [ 1, 2, 4, 8 ].forEach(function (bytes) {
18138 var bits = bytes * 8;
18140 self['word' + bits + 'le']
18141 = self['word' + bits + 'lu']
18142 = decode(bytes, decodeLEu);
18144 self['word' + bits + 'ls']
18145 = decode(bytes, decodeLEs);
18147 self['word' + bits + 'be']
18148 = self['word' + bits + 'bu']
18149 = decode(bytes, decodeBEu);
18151 self['word' + bits + 'bs']
18152 = decode(bytes, decodeBEs);
18155 // word8be(n) == word8le(n) for all n
18156 self.word8 = self.word8u = self.word8be;
18157 self.word8s = self.word8bs;
18165 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18167 var Traverse = __webpack_require__(125);
18168 var EventEmitter = __webpack_require__(68).EventEmitter;
18170 module.exports = Chainsaw;
18171 function Chainsaw (builder) {
18172 var saw = Chainsaw.saw(builder, {});
18173 var r = builder.call(saw.handlers, saw);
18174 if (r !== undefined) saw.handlers = r;
18176 return saw.chain();
18179 Chainsaw.light = function ChainsawLight (builder) {
18180 var saw = Chainsaw.saw(builder, {});
18181 var r = builder.call(saw.handlers, saw);
18182 if (r !== undefined) saw.handlers = r;
18183 return saw.chain();
18186 Chainsaw.saw = function (builder, handlers) {
18187 var saw = new EventEmitter;
18188 saw.handlers = handlers;
18191 saw.chain = function () {
18192 var ch = Traverse(saw.handlers).map(function (node) {
18193 if (this.isRoot) return node;
18194 var ps = this.path;
18196 if (typeof node === 'function') {
18197 this.update(function () {
18200 args : [].slice.call(arguments)
18207 process.nextTick(function () {
18215 saw.pop = function () {
18216 return saw.actions.shift();
18219 saw.next = function () {
18220 var action = saw.pop();
18225 else if (!action.trap) {
18226 var node = saw.handlers;
18227 action.path.forEach(function (key) { node = node[key] });
18228 node.apply(saw.handlers, action.args);
18232 saw.nest = function (cb) {
18233 var args = [].slice.call(arguments, 1);
18234 var autonext = true;
18236 if (typeof cb === 'boolean') {
18241 var s = Chainsaw.saw(builder, {});
18242 var r = builder.call(s.handlers, s);
18244 if (r !== undefined) s.handlers = r;
18246 // If we are recording...
18247 if ("undefined" !== typeof saw.step) {
18248 // ... our children should, too
18252 cb.apply(s.chain(), args);
18253 if (autonext !== false) s.on('end', saw.next);
18256 saw.record = function () {
18257 upgradeChainsaw(saw);
18260 ['trap', 'down', 'jump'].forEach(function (method) {
18261 saw[method] = function () {
18262 throw new Error("To use the trap, down and jump features, please "+
18263 "call record() first to start recording actions.");
18270 function upgradeChainsaw(saw) {
18274 saw.pop = function () {
18275 return saw.actions[saw.step++];
18278 saw.trap = function (name, cb) {
18279 var ps = Array.isArray(name) ? name : [name];
18288 saw.down = function (name) {
18289 var ps = (Array.isArray(name) ? name : [name]).join('/');
18290 var i = saw.actions.slice(saw.step).map(function (x) {
18291 if (x.trap && x.step <= saw.step) return false;
18292 return x.path.join('/') == ps;
18295 if (i >= 0) saw.step += i;
18296 else saw.step = saw.actions.length;
18298 var act = saw.actions[saw.step - 1];
18299 if (act && act.trap) {
18301 saw.step = act.step;
18307 saw.jump = function (step) {
18316 /***/ ((module) => {
18318 module.exports = Traverse;
18319 function Traverse (obj) {
18320 if (!(this instanceof Traverse)) return new Traverse(obj);
18324 Traverse.prototype.get = function (ps) {
18325 var node = this.value;
18326 for (var i = 0; i < ps.length; i ++) {
18328 if (!Object.hasOwnProperty.call(node, key)) {
18337 Traverse.prototype.set = function (ps, value) {
18338 var node = this.value;
18339 for (var i = 0; i < ps.length - 1; i ++) {
18341 if (!Object.hasOwnProperty.call(node, key)) node[key] = {};
18344 node[ps[i]] = value;
18348 Traverse.prototype.map = function (cb) {
18349 return walk(this.value, cb, true);
18352 Traverse.prototype.forEach = function (cb) {
18353 this.value = walk(this.value, cb, false);
18357 Traverse.prototype.reduce = function (cb, init) {
18358 var skip = arguments.length === 1;
18359 var acc = skip ? this.value : init;
18360 this.forEach(function (x) {
18361 if (!this.isRoot || !skip) {
18362 acc = cb.call(this, acc, x);
18368 Traverse.prototype.deepEqual = function (obj) {
18369 if (arguments.length !== 1) {
18371 'deepEqual requires exactly one object to compare against'
18378 this.forEach(function (y) {
18379 var notEqual = (function () {
18385 //if (node === undefined || node === null) return notEqual();
18387 if (!this.isRoot) {
18389 if (!Object.hasOwnProperty.call(node, this.key)) {
18393 if (typeof node !== 'object') return notEqual();
18394 node = node[this.key];
18399 this.post(function () {
18403 var toS = function (o) {
18404 return Object.prototype.toString.call(o);
18407 if (this.circular) {
18408 if (Traverse(obj).get(this.circular.path) !== x) notEqual();
18410 else if (typeof x !== typeof y) {
18413 else if (x === null || y === null || x === undefined || y === undefined) {
18414 if (x !== y) notEqual();
18416 else if (x.__proto__ !== y.__proto__) {
18419 else if (x === y) {
18422 else if (typeof x === 'function') {
18423 if (x instanceof RegExp) {
18424 // both regexps on account of the __proto__ check
18425 if (x.toString() != y.toString()) notEqual();
18427 else if (x !== y) notEqual();
18429 else if (typeof x === 'object') {
18430 if (toS(y) === '[object Arguments]'
18431 || toS(x) === '[object Arguments]') {
18432 if (toS(x) !== toS(y)) {
18436 else if (x instanceof Date || y instanceof Date) {
18437 if (!(x instanceof Date) || !(y instanceof Date)
18438 || x.getTime() !== y.getTime()) {
18443 var kx = Object.keys(x);
18444 var ky = Object.keys(y);
18445 if (kx.length !== ky.length) return notEqual();
18446 for (var i = 0; i < kx.length; i++) {
18448 if (!Object.hasOwnProperty.call(y, k)) {
18459 Traverse.prototype.paths = function () {
18461 this.forEach(function (x) {
18462 acc.push(this.path);
18467 Traverse.prototype.nodes = function () {
18469 this.forEach(function (x) {
18470 acc.push(this.node);
18475 Traverse.prototype.clone = function () {
18476 var parents = [], nodes = [];
18478 return (function clone (src) {
18479 for (var i = 0; i < parents.length; i++) {
18480 if (parents[i] === src) {
18485 if (typeof src === 'object' && src !== null) {
18486 var dst = copy(src);
18491 Object.keys(src).forEach(function (key) {
18492 dst[key] = clone(src[key]);
18505 function walk (root, cb, immutable) {
18510 return (function walker (node_) {
18511 var node = immutable ? copy(node_) : node_;
18512 var modifiers = {};
18517 path : [].concat(path),
18518 parent : parents.slice(-1)[0],
18519 key : path.slice(-1)[0],
18520 isRoot : path.length === 0,
18521 level : path.length,
18523 update : function (x) {
18524 if (!state.isRoot) {
18525 state.parent.node[state.key] = x;
18529 'delete' : function () {
18530 delete state.parent.node[state.key];
18532 remove : function () {
18533 if (Array.isArray(state.parent.node)) {
18534 state.parent.node.splice(state.key, 1);
18537 delete state.parent.node[state.key];
18540 before : function (f) { modifiers.before = f },
18541 after : function (f) { modifiers.after = f },
18542 pre : function (f) { modifiers.pre = f },
18543 post : function (f) { modifiers.post = f },
18544 stop : function () { alive = false }
18547 if (!alive) return state;
18549 if (typeof node === 'object' && node !== null) {
18550 state.isLeaf = Object.keys(node).length == 0;
18552 for (var i = 0; i < parents.length; i++) {
18553 if (parents[i].node_ === node_) {
18554 state.circular = parents[i];
18560 state.isLeaf = true;
18563 state.notLeaf = !state.isLeaf;
18564 state.notRoot = !state.isRoot;
18566 // use return values to update if defined
18567 var ret = cb.call(state, state.node);
18568 if (ret !== undefined && state.update) state.update(ret);
18569 if (modifiers.before) modifiers.before.call(state, state.node);
18571 if (typeof state.node == 'object'
18572 && state.node !== null && !state.circular) {
18573 parents.push(state);
18575 var keys = Object.keys(state.node);
18576 keys.forEach(function (key, i) {
18579 if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
18581 var child = walker(state.node[key]);
18582 if (immutable && Object.hasOwnProperty.call(state.node, key)) {
18583 state.node[key] = child.node;
18586 child.isLast = i == keys.length - 1;
18587 child.isFirst = i == 0;
18589 if (modifiers.post) modifiers.post.call(state, child);
18596 if (modifiers.after) modifiers.after.call(state, state.node);
18602 Object.keys(Traverse.prototype).forEach(function (key) {
18603 Traverse[key] = function (obj) {
18604 var args = [].slice.call(arguments, 1);
18605 var t = Traverse(obj);
18606 return t[key].apply(t, args);
18610 function copy (src) {
18611 if (typeof src === 'object' && src !== null) {
18614 if (Array.isArray(src)) {
18617 else if (src instanceof Date) {
18618 dst = new Date(src);
18620 else if (src instanceof Boolean) {
18621 dst = new Boolean(src);
18623 else if (src instanceof Number) {
18624 dst = new Number(src);
18626 else if (src instanceof String) {
18627 dst = new String(src);
18630 dst = Object.create(Object.getPrototypeOf(src));
18633 Object.keys(src).forEach(function (key) {
18634 dst[key] = src[key];
18644 /***/ ((module) => {
18646 module.exports = Buffers;
18648 function Buffers (bufs) {
18649 if (!(this instanceof Buffers)) return new Buffers(bufs);
18650 this.buffers = bufs || [];
18651 this.length = this.buffers.reduce(function (size, buf) {
18652 return size + buf.length
18656 Buffers.prototype.push = function () {
18657 for (var i = 0; i < arguments.length; i++) {
18658 if (!Buffer.isBuffer(arguments[i])) {
18659 throw new TypeError('Tried to push a non-buffer');
18663 for (var i = 0; i < arguments.length; i++) {
18664 var buf = arguments[i];
18665 this.buffers.push(buf);
18666 this.length += buf.length;
18668 return this.length;
18671 Buffers.prototype.unshift = function () {
18672 for (var i = 0; i < arguments.length; i++) {
18673 if (!Buffer.isBuffer(arguments[i])) {
18674 throw new TypeError('Tried to unshift a non-buffer');
18678 for (var i = 0; i < arguments.length; i++) {
18679 var buf = arguments[i];
18680 this.buffers.unshift(buf);
18681 this.length += buf.length;
18683 return this.length;
18686 Buffers.prototype.copy = function (dst, dStart, start, end) {
18687 return this.slice(start, end).copy(dst, dStart, 0, end - start);
18690 Buffers.prototype.splice = function (i, howMany) {
18691 var buffers = this.buffers;
18692 var index = i >= 0 ? i : this.length - i;
18693 var reps = [].slice.call(arguments, 2);
18695 if (howMany === undefined) {
18696 howMany = this.length - index;
18698 else if (howMany > this.length - index) {
18699 howMany = this.length - index;
18702 for (var i = 0; i < reps.length; i++) {
18703 this.length += reps[i].length;
18706 var removed = new Buffers();
18709 var startBytes = 0;
18712 ii < buffers.length && startBytes + buffers[ii].length < index;
18714 ) { startBytes += buffers[ii].length }
18716 if (index - startBytes > 0) {
18717 var start = index - startBytes;
18719 if (start + howMany < buffers[ii].length) {
18720 removed.push(buffers[ii].slice(start, start + howMany));
18722 var orig = buffers[ii];
18723 //var buf = new Buffer(orig.length - howMany);
18724 var buf0 = new Buffer(start);
18725 for (var i = 0; i < start; i++) {
18729 var buf1 = new Buffer(orig.length - start - howMany);
18730 for (var i = start + howMany; i < orig.length; i++) {
18731 buf1[ i - howMany - start ] = orig[i]
18734 if (reps.length > 0) {
18735 var reps_ = reps.slice();
18736 reps_.unshift(buf0);
18738 buffers.splice.apply(buffers, [ ii, 1 ].concat(reps_));
18739 ii += reps_.length;
18743 buffers.splice(ii, 1, buf0, buf1);
18744 //buffers[ii] = buf;
18749 removed.push(buffers[ii].slice(start));
18750 buffers[ii] = buffers[ii].slice(0, start);
18755 if (reps.length > 0) {
18756 buffers.splice.apply(buffers, [ ii, 0 ].concat(reps));
18760 while (removed.length < howMany) {
18761 var buf = buffers[ii];
18762 var len = buf.length;
18763 var take = Math.min(len, howMany - removed.length);
18765 if (take === len) {
18767 buffers.splice(ii, 1);
18770 removed.push(buf.slice(0, take));
18771 buffers[ii] = buffers[ii].slice(take);
18775 this.length -= removed.length;
18780 Buffers.prototype.slice = function (i, j) {
18781 var buffers = this.buffers;
18782 if (j === undefined) j = this.length;
18783 if (i === undefined) i = 0;
18785 if (j > this.length) j = this.length;
18787 var startBytes = 0;
18790 si < buffers.length && startBytes + buffers[si].length <= i;
18792 ) { startBytes += buffers[si].length }
18794 var target = new Buffer(j - i);
18797 for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
18798 var len = buffers[ii].length;
18800 var start = ti === 0 ? i - startBytes : 0;
18801 var end = ti + len >= j - i
18802 ? Math.min(start + (j - i) - ti, len)
18806 buffers[ii].copy(target, ti, start, end);
18813 Buffers.prototype.pos = function (i) {
18814 if (i < 0 || i >= this.length) throw new Error('oob');
18815 var l = i, bi = 0, bu = null;
18817 bu = this.buffers[bi];
18818 if (l < bu.length) {
18819 return {buf: bi, offset: l};
18827 Buffers.prototype.get = function get (i) {
18828 var pos = this.pos(i);
18830 return this.buffers[pos.buf].get(pos.offset);
18833 Buffers.prototype.set = function set (i, b) {
18834 var pos = this.pos(i);
18836 return this.buffers[pos.buf].set(pos.offset, b);
18839 Buffers.prototype.indexOf = function (needle, offset) {
18840 if ("string" === typeof needle) {
18841 needle = new Buffer(needle);
18842 } else if (needle instanceof Buffer) {
18843 // already a buffer
18845 throw new Error('Invalid type for a search string');
18848 if (!needle.length) {
18852 if (!this.length) {
18856 var i = 0, j = 0, match = 0, mstart, pos = 0;
18858 // start search from a particular point in the virtual buffer
18860 var p = this.pos(offset);
18866 // for each character in virtual buffer
18868 while (j >= this.buffers[i].length) {
18872 if (i >= this.buffers.length) {
18873 // search string not found
18878 var char = this.buffers[i][j];
18880 if (char == needle[match]) {
18881 // keep track where match started
18890 if (match == needle.length) {
18894 } else if (match != 0) {
18895 // a partial match ended, go back to match starting position
18896 // this will continue the search at the next character
18908 Buffers.prototype.toBuffer = function() {
18909 return this.slice();
18912 Buffers.prototype.toString = function(encoding, start, end) {
18913 return this.slice(start, end).toString(encoding);
18919 /***/ ((module) => {
18921 module.exports = function (store) {
18922 function getset (name, value) {
18923 var node = vars.store;
18924 var keys = name.split('.');
18925 keys.slice(0,-1).forEach(function (k) {
18926 if (node[k] === undefined) node[k] = {};
18929 var key = keys[keys.length - 1];
18930 if (arguments.length == 1) {
18934 return node[key] = value;
18939 get : function (name) {
18940 return getset(name);
18942 set : function (name, value) {
18943 return getset(name, value);
18945 store : store || {},
18953 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18958 if (typeof Promise !== "undefined") old = Promise;
18959 function noConflict() {
18960 try { if (Promise === bluebird) Promise = old; }
18964 var bluebird = __webpack_require__(129)();
18965 bluebird.noConflict = noConflict;
18966 module.exports = bluebird;
18971 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18975 module.exports = function() {
18976 var makeSelfResolutionError = function () {
18977 return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a");
18979 var reflectHandler = function() {
18980 return new Promise.PromiseInspection(this._target());
18982 var apiRejection = function(msg) {
18983 return Promise.reject(new TypeError(msg));
18985 function Proxyable() {}
18986 var UNDEFINED_BINDING = {};
18987 var util = __webpack_require__(130);
18991 getDomain = function() {
18992 var ret = process.domain;
18993 if (ret === undefined) ret = null;
18997 getDomain = function() {
19001 util.notEnumerableProp(Promise, "_getDomain", getDomain);
19003 var es5 = __webpack_require__(131);
19004 var Async = __webpack_require__(132);
19005 var async = new Async();
19006 es5.defineProperty(Promise, "_async", {value: async});
19007 var errors = __webpack_require__(135);
19008 var TypeError = Promise.TypeError = errors.TypeError;
19009 Promise.RangeError = errors.RangeError;
19010 var CancellationError = Promise.CancellationError = errors.CancellationError;
19011 Promise.TimeoutError = errors.TimeoutError;
19012 Promise.OperationalError = errors.OperationalError;
19013 Promise.RejectionError = errors.OperationalError;
19014 Promise.AggregateError = errors.AggregateError;
19015 var INTERNAL = function(){};
19017 var NEXT_FILTER = {};
19018 var tryConvertToPromise = __webpack_require__(136)(Promise, INTERNAL);
19020 __webpack_require__(137)(Promise, INTERNAL,
19021 tryConvertToPromise, apiRejection, Proxyable);
19022 var Context = __webpack_require__(138)(Promise);
19023 /*jshint unused:false*/
19024 var createContext = Context.create;
19025 var debug = __webpack_require__(139)(Promise, Context);
19026 var CapturedTrace = debug.CapturedTrace;
19027 var PassThroughHandlerContext =
19028 __webpack_require__(140)(Promise, tryConvertToPromise);
19029 var catchFilter = __webpack_require__(141)(NEXT_FILTER);
19030 var nodebackForPromise = __webpack_require__(142);
19031 var errorObj = util.errorObj;
19032 var tryCatch = util.tryCatch;
19033 function check(self, executor) {
19034 if (typeof executor !== "function") {
19035 throw new TypeError("expecting a function but got " + util.classString(executor));
19037 if (self.constructor !== Promise) {
19038 throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a");
19042 function Promise(executor) {
19043 this._bitField = 0;
19044 this._fulfillmentHandler0 = undefined;
19045 this._rejectionHandler0 = undefined;
19046 this._promise0 = undefined;
19047 this._receiver0 = undefined;
19048 if (executor !== INTERNAL) {
19049 check(this, executor);
19050 this._resolveFromExecutor(executor);
19052 this._promiseCreated();
19053 this._fireEvent("promiseCreated", this);
19056 Promise.prototype.toString = function () {
19057 return "[object Promise]";
19060 Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
19061 var len = arguments.length;
19063 var catchInstances = new Array(len - 1),
19065 for (i = 0; i < len - 1; ++i) {
19066 var item = arguments[i];
19067 if (util.isObject(item)) {
19068 catchInstances[j++] = item;
19070 return apiRejection("expecting an object but got " +
19071 "A catch statement predicate " + util.classString(item));
19074 catchInstances.length = j;
19076 return this.then(undefined, catchFilter(catchInstances, fn, this));
19078 return this.then(undefined, fn);
19081 Promise.prototype.reflect = function () {
19082 return this._then(reflectHandler,
19083 reflectHandler, undefined, this, undefined);
19086 Promise.prototype.then = function (didFulfill, didReject) {
19087 if (debug.warnings() && arguments.length > 0 &&
19088 typeof didFulfill !== "function" &&
19089 typeof didReject !== "function") {
19090 var msg = ".then() only accepts functions but was passed: " +
19091 util.classString(didFulfill);
19092 if (arguments.length > 1) {
19093 msg += ", " + util.classString(didReject);
19097 return this._then(didFulfill, didReject, undefined, undefined, undefined);
19100 Promise.prototype.done = function (didFulfill, didReject) {
19102 this._then(didFulfill, didReject, undefined, undefined, undefined);
19103 promise._setIsFinal();
19106 Promise.prototype.spread = function (fn) {
19107 if (typeof fn !== "function") {
19108 return apiRejection("expecting a function but got " + util.classString(fn));
19110 return this.all()._then(fn, undefined, undefined, APPLY, undefined);
19113 Promise.prototype.toJSON = function () {
19115 isFulfilled: false,
19117 fulfillmentValue: undefined,
19118 rejectionReason: undefined
19120 if (this.isFulfilled()) {
19121 ret.fulfillmentValue = this.value();
19122 ret.isFulfilled = true;
19123 } else if (this.isRejected()) {
19124 ret.rejectionReason = this.reason();
19125 ret.isRejected = true;
19130 Promise.prototype.all = function () {
19131 if (arguments.length > 0) {
19132 this._warn(".all() was passed arguments but it does not take any");
19134 return new PromiseArray(this).promise();
19137 Promise.prototype.error = function (fn) {
19138 return this.caught(util.originatesFromRejection, fn);
19141 Promise.getNewLibraryCopy = module.exports;
19143 Promise.is = function (val) {
19144 return val instanceof Promise;
19147 Promise.fromNode = Promise.fromCallback = function(fn) {
19148 var ret = new Promise(INTERNAL);
19149 ret._captureStackTrace();
19150 var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
19152 var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
19153 if (result === errorObj) {
19154 ret._rejectCallback(result.e, true);
19156 if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
19160 Promise.all = function (promises) {
19161 return new PromiseArray(promises).promise();
19164 Promise.cast = function (obj) {
19165 var ret = tryConvertToPromise(obj);
19166 if (!(ret instanceof Promise)) {
19167 ret = new Promise(INTERNAL);
19168 ret._captureStackTrace();
19169 ret._setFulfilled();
19170 ret._rejectionHandler0 = obj;
19175 Promise.resolve = Promise.fulfilled = Promise.cast;
19177 Promise.reject = Promise.rejected = function (reason) {
19178 var ret = new Promise(INTERNAL);
19179 ret._captureStackTrace();
19180 ret._rejectCallback(reason, true);
19184 Promise.setScheduler = function(fn) {
19185 if (typeof fn !== "function") {
19186 throw new TypeError("expecting a function but got " + util.classString(fn));
19188 return async.setScheduler(fn);
19191 Promise.prototype._then = function (
19197 var haveInternalData = internalData !== undefined;
19198 var promise = haveInternalData ? internalData : new Promise(INTERNAL);
19199 var target = this._target();
19200 var bitField = target._bitField;
19202 if (!haveInternalData) {
19203 promise._propagateFrom(this, 3);
19204 promise._captureStackTrace();
19205 if (receiver === undefined &&
19206 ((this._bitField & 2097152) !== 0)) {
19207 if (!((bitField & 50397184) === 0)) {
19208 receiver = this._boundValue();
19210 receiver = target === this ? undefined : this._boundTo;
19213 this._fireEvent("promiseChained", this, promise);
19216 var domain = getDomain();
19217 if (!((bitField & 50397184) === 0)) {
19218 var handler, value, settler = target._settlePromiseCtx;
19219 if (((bitField & 33554432) !== 0)) {
19220 value = target._rejectionHandler0;
19221 handler = didFulfill;
19222 } else if (((bitField & 16777216) !== 0)) {
19223 value = target._fulfillmentHandler0;
19224 handler = didReject;
19225 target._unsetRejectionIsUnhandled();
19227 settler = target._settlePromiseLateCancellationObserver;
19228 value = new CancellationError("late cancellation observer");
19229 target._attachExtraTrace(value);
19230 handler = didReject;
19233 async.invoke(settler, target, {
19234 handler: domain === null ? handler
19235 : (typeof handler === "function" &&
19236 util.domainBind(domain, handler)),
19238 receiver: receiver,
19242 target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
19248 Promise.prototype._length = function () {
19249 return this._bitField & 65535;
19252 Promise.prototype._isFateSealed = function () {
19253 return (this._bitField & 117506048) !== 0;
19256 Promise.prototype._isFollowing = function () {
19257 return (this._bitField & 67108864) === 67108864;
19260 Promise.prototype._setLength = function (len) {
19261 this._bitField = (this._bitField & -65536) |
19265 Promise.prototype._setFulfilled = function () {
19266 this._bitField = this._bitField | 33554432;
19267 this._fireEvent("promiseFulfilled", this);
19270 Promise.prototype._setRejected = function () {
19271 this._bitField = this._bitField | 16777216;
19272 this._fireEvent("promiseRejected", this);
19275 Promise.prototype._setFollowing = function () {
19276 this._bitField = this._bitField | 67108864;
19277 this._fireEvent("promiseResolved", this);
19280 Promise.prototype._setIsFinal = function () {
19281 this._bitField = this._bitField | 4194304;
19284 Promise.prototype._isFinal = function () {
19285 return (this._bitField & 4194304) > 0;
19288 Promise.prototype._unsetCancelled = function() {
19289 this._bitField = this._bitField & (~65536);
19292 Promise.prototype._setCancelled = function() {
19293 this._bitField = this._bitField | 65536;
19294 this._fireEvent("promiseCancelled", this);
19297 Promise.prototype._setWillBeCancelled = function() {
19298 this._bitField = this._bitField | 8388608;
19301 Promise.prototype._setAsyncGuaranteed = function() {
19302 if (async.hasCustomScheduler()) return;
19303 this._bitField = this._bitField | 134217728;
19306 Promise.prototype._receiverAt = function (index) {
19307 var ret = index === 0 ? this._receiver0 : this[
19308 index * 4 - 4 + 3];
19309 if (ret === UNDEFINED_BINDING) {
19311 } else if (ret === undefined && this._isBound()) {
19312 return this._boundValue();
19317 Promise.prototype._promiseAt = function (index) {
19319 index * 4 - 4 + 2];
19322 Promise.prototype._fulfillmentHandlerAt = function (index) {
19324 index * 4 - 4 + 0];
19327 Promise.prototype._rejectionHandlerAt = function (index) {
19329 index * 4 - 4 + 1];
19332 Promise.prototype._boundValue = function() {};
19334 Promise.prototype._migrateCallback0 = function (follower) {
19335 var bitField = follower._bitField;
19336 var fulfill = follower._fulfillmentHandler0;
19337 var reject = follower._rejectionHandler0;
19338 var promise = follower._promise0;
19339 var receiver = follower._receiverAt(0);
19340 if (receiver === undefined) receiver = UNDEFINED_BINDING;
19341 this._addCallbacks(fulfill, reject, promise, receiver, null);
19344 Promise.prototype._migrateCallbackAt = function (follower, index) {
19345 var fulfill = follower._fulfillmentHandlerAt(index);
19346 var reject = follower._rejectionHandlerAt(index);
19347 var promise = follower._promiseAt(index);
19348 var receiver = follower._receiverAt(index);
19349 if (receiver === undefined) receiver = UNDEFINED_BINDING;
19350 this._addCallbacks(fulfill, reject, promise, receiver, null);
19353 Promise.prototype._addCallbacks = function (
19360 var index = this._length();
19362 if (index >= 65535 - 4) {
19364 this._setLength(0);
19368 this._promise0 = promise;
19369 this._receiver0 = receiver;
19370 if (typeof fulfill === "function") {
19371 this._fulfillmentHandler0 =
19372 domain === null ? fulfill : util.domainBind(domain, fulfill);
19374 if (typeof reject === "function") {
19375 this._rejectionHandler0 =
19376 domain === null ? reject : util.domainBind(domain, reject);
19379 var base = index * 4 - 4;
19380 this[base + 2] = promise;
19381 this[base + 3] = receiver;
19382 if (typeof fulfill === "function") {
19384 domain === null ? fulfill : util.domainBind(domain, fulfill);
19386 if (typeof reject === "function") {
19388 domain === null ? reject : util.domainBind(domain, reject);
19391 this._setLength(index + 1);
19395 Promise.prototype._proxy = function (proxyable, arg) {
19396 this._addCallbacks(undefined, undefined, arg, proxyable, null);
19399 Promise.prototype._resolveCallback = function(value, shouldBind) {
19400 if (((this._bitField & 117506048) !== 0)) return;
19401 if (value === this)
19402 return this._rejectCallback(makeSelfResolutionError(), false);
19403 var maybePromise = tryConvertToPromise(value, this);
19404 if (!(maybePromise instanceof Promise)) return this._fulfill(value);
19406 if (shouldBind) this._propagateFrom(maybePromise, 2);
19408 var promise = maybePromise._target();
19410 if (promise === this) {
19411 this._reject(makeSelfResolutionError());
19415 var bitField = promise._bitField;
19416 if (((bitField & 50397184) === 0)) {
19417 var len = this._length();
19418 if (len > 0) promise._migrateCallback0(this);
19419 for (var i = 1; i < len; ++i) {
19420 promise._migrateCallbackAt(this, i);
19422 this._setFollowing();
19423 this._setLength(0);
19424 this._setFollowee(promise);
19425 } else if (((bitField & 33554432) !== 0)) {
19426 this._fulfill(promise._value());
19427 } else if (((bitField & 16777216) !== 0)) {
19428 this._reject(promise._reason());
19430 var reason = new CancellationError("late cancellation observer");
19431 promise._attachExtraTrace(reason);
19432 this._reject(reason);
19436 Promise.prototype._rejectCallback =
19437 function(reason, synchronous, ignoreNonErrorWarnings) {
19438 var trace = util.ensureErrorObject(reason);
19439 var hasStack = trace === reason;
19440 if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
19441 var message = "a promise was rejected with a non-error: " +
19442 util.classString(reason);
19443 this._warn(message, true);
19445 this._attachExtraTrace(trace, synchronous ? hasStack : false);
19446 this._reject(reason);
19449 Promise.prototype._resolveFromExecutor = function (executor) {
19450 var promise = this;
19451 this._captureStackTrace();
19452 this._pushContext();
19453 var synchronous = true;
19454 var r = this._execute(executor, function(value) {
19455 promise._resolveCallback(value);
19456 }, function (reason) {
19457 promise._rejectCallback(reason, synchronous);
19459 synchronous = false;
19460 this._popContext();
19462 if (r !== undefined) {
19463 promise._rejectCallback(r, true);
19467 Promise.prototype._settlePromiseFromHandler = function (
19468 handler, receiver, value, promise
19470 var bitField = promise._bitField;
19471 if (((bitField & 65536) !== 0)) return;
19472 promise._pushContext();
19474 if (receiver === APPLY) {
19475 if (!value || typeof value.length !== "number") {
19477 x.e = new TypeError("cannot .spread() a non-array: " +
19478 util.classString(value));
19480 x = tryCatch(handler).apply(this._boundValue(), value);
19483 x = tryCatch(handler).call(receiver, value);
19485 var promiseCreated = promise._popContext();
19486 bitField = promise._bitField;
19487 if (((bitField & 65536) !== 0)) return;
19489 if (x === NEXT_FILTER) {
19490 promise._reject(value);
19491 } else if (x === errorObj) {
19492 promise._rejectCallback(x.e, false);
19494 debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
19495 promise._resolveCallback(x);
19499 Promise.prototype._target = function() {
19501 while (ret._isFollowing()) ret = ret._followee();
19505 Promise.prototype._followee = function() {
19506 return this._rejectionHandler0;
19509 Promise.prototype._setFollowee = function(promise) {
19510 this._rejectionHandler0 = promise;
19513 Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
19514 var isPromise = promise instanceof Promise;
19515 var bitField = this._bitField;
19516 var asyncGuaranteed = ((bitField & 134217728) !== 0);
19517 if (((bitField & 65536) !== 0)) {
19518 if (isPromise) promise._invokeInternalOnCancel();
19520 if (receiver instanceof PassThroughHandlerContext &&
19521 receiver.isFinallyHandler()) {
19522 receiver.cancelPromise = promise;
19523 if (tryCatch(handler).call(receiver, value) === errorObj) {
19524 promise._reject(errorObj.e);
19526 } else if (handler === reflectHandler) {
19527 promise._fulfill(reflectHandler.call(receiver));
19528 } else if (receiver instanceof Proxyable) {
19529 receiver._promiseCancelled(promise);
19530 } else if (isPromise || promise instanceof PromiseArray) {
19535 } else if (typeof handler === "function") {
19537 handler.call(receiver, value, promise);
19539 if (asyncGuaranteed) promise._setAsyncGuaranteed();
19540 this._settlePromiseFromHandler(handler, receiver, value, promise);
19542 } else if (receiver instanceof Proxyable) {
19543 if (!receiver._isResolved()) {
19544 if (((bitField & 33554432) !== 0)) {
19545 receiver._promiseFulfilled(value, promise);
19547 receiver._promiseRejected(value, promise);
19550 } else if (isPromise) {
19551 if (asyncGuaranteed) promise._setAsyncGuaranteed();
19552 if (((bitField & 33554432) !== 0)) {
19553 promise._fulfill(value);
19555 promise._reject(value);
19560 Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
19561 var handler = ctx.handler;
19562 var promise = ctx.promise;
19563 var receiver = ctx.receiver;
19564 var value = ctx.value;
19565 if (typeof handler === "function") {
19566 if (!(promise instanceof Promise)) {
19567 handler.call(receiver, value, promise);
19569 this._settlePromiseFromHandler(handler, receiver, value, promise);
19571 } else if (promise instanceof Promise) {
19572 promise._reject(value);
19576 Promise.prototype._settlePromiseCtx = function(ctx) {
19577 this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
19580 Promise.prototype._settlePromise0 = function(handler, value, bitField) {
19581 var promise = this._promise0;
19582 var receiver = this._receiverAt(0);
19583 this._promise0 = undefined;
19584 this._receiver0 = undefined;
19585 this._settlePromise(promise, handler, receiver, value);
19588 Promise.prototype._clearCallbackDataAtIndex = function(index) {
19589 var base = index * 4 - 4;
19593 this[base + 1] = undefined;
19596 Promise.prototype._fulfill = function (value) {
19597 var bitField = this._bitField;
19598 if (((bitField & 117506048) >>> 16)) return;
19599 if (value === this) {
19600 var err = makeSelfResolutionError();
19601 this._attachExtraTrace(err);
19602 return this._reject(err);
19604 this._setFulfilled();
19605 this._rejectionHandler0 = value;
19607 if ((bitField & 65535) > 0) {
19608 if (((bitField & 134217728) !== 0)) {
19609 this._settlePromises();
19611 async.settlePromises(this);
19616 Promise.prototype._reject = function (reason) {
19617 var bitField = this._bitField;
19618 if (((bitField & 117506048) >>> 16)) return;
19619 this._setRejected();
19620 this._fulfillmentHandler0 = reason;
19622 if (this._isFinal()) {
19623 return async.fatalError(reason, util.isNode);
19626 if ((bitField & 65535) > 0) {
19627 async.settlePromises(this);
19629 this._ensurePossibleRejectionHandled();
19633 Promise.prototype._fulfillPromises = function (len, value) {
19634 for (var i = 1; i < len; i++) {
19635 var handler = this._fulfillmentHandlerAt(i);
19636 var promise = this._promiseAt(i);
19637 var receiver = this._receiverAt(i);
19638 this._clearCallbackDataAtIndex(i);
19639 this._settlePromise(promise, handler, receiver, value);
19643 Promise.prototype._rejectPromises = function (len, reason) {
19644 for (var i = 1; i < len; i++) {
19645 var handler = this._rejectionHandlerAt(i);
19646 var promise = this._promiseAt(i);
19647 var receiver = this._receiverAt(i);
19648 this._clearCallbackDataAtIndex(i);
19649 this._settlePromise(promise, handler, receiver, reason);
19653 Promise.prototype._settlePromises = function () {
19654 var bitField = this._bitField;
19655 var len = (bitField & 65535);
19658 if (((bitField & 16842752) !== 0)) {
19659 var reason = this._fulfillmentHandler0;
19660 this._settlePromise0(this._rejectionHandler0, reason, bitField);
19661 this._rejectPromises(len, reason);
19663 var value = this._rejectionHandler0;
19664 this._settlePromise0(this._fulfillmentHandler0, value, bitField);
19665 this._fulfillPromises(len, value);
19667 this._setLength(0);
19669 this._clearCancellationData();
19672 Promise.prototype._settledValue = function() {
19673 var bitField = this._bitField;
19674 if (((bitField & 33554432) !== 0)) {
19675 return this._rejectionHandler0;
19676 } else if (((bitField & 16777216) !== 0)) {
19677 return this._fulfillmentHandler0;
19681 function deferResolve(v) {this.promise._resolveCallback(v);}
19682 function deferReject(v) {this.promise._rejectCallback(v, false);}
19684 Promise.defer = Promise.pending = function() {
19685 debug.deprecated("Promise.defer", "new Promise");
19686 var promise = new Promise(INTERNAL);
19689 resolve: deferResolve,
19690 reject: deferReject
19694 util.notEnumerableProp(Promise,
19695 "_makeSelfResolutionError",
19696 makeSelfResolutionError);
19698 __webpack_require__(143)(Promise, INTERNAL, tryConvertToPromise, apiRejection,
19700 __webpack_require__(144)(Promise, INTERNAL, tryConvertToPromise, debug);
19701 __webpack_require__(145)(Promise, PromiseArray, apiRejection, debug);
19702 __webpack_require__(146)(Promise);
19703 __webpack_require__(147)(Promise);
19704 __webpack_require__(148)(
19705 Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
19706 Promise.Promise = Promise;
19707 Promise.version = "3.4.7";
19708 __webpack_require__(149)(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
19709 __webpack_require__(150)(Promise);
19710 __webpack_require__(151)(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
19711 __webpack_require__(152)(Promise, INTERNAL, debug);
19712 __webpack_require__(153)(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
19713 __webpack_require__(154)(Promise);
19714 __webpack_require__(155)(Promise, INTERNAL);
19715 __webpack_require__(156)(Promise, PromiseArray, tryConvertToPromise, apiRejection);
19716 __webpack_require__(157)(Promise, INTERNAL, tryConvertToPromise, apiRejection);
19717 __webpack_require__(158)(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
19718 __webpack_require__(159)(Promise, PromiseArray, debug);
19719 __webpack_require__(160)(Promise, PromiseArray, apiRejection);
19720 __webpack_require__(161)(Promise, INTERNAL);
19721 __webpack_require__(162)(Promise, INTERNAL);
19722 __webpack_require__(163)(Promise);
19724 util.toFastProperties(Promise);
19725 util.toFastProperties(Promise.prototype);
19726 function fillTypes(value) {
19727 var p = new Promise(INTERNAL);
19728 p._fulfillmentHandler0 = value;
19729 p._rejectionHandler0 = value;
19730 p._promise0 = value;
19731 p._receiver0 = value;
19733 // Complete slack tracking, opt out of field-type tracking and
19739 fillTypes(function(){});
19740 fillTypes(undefined);
19742 fillTypes(new Promise(INTERNAL));
19743 debug.setBounds(Async.firstLineError, util.lastLineError);
19751 /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
19755 var es5 = __webpack_require__(131);
19756 var canEvaluate = typeof navigator == "undefined";
19758 var errorObj = {e: {}};
19759 var tryCatchTarget;
19760 var globalObject = typeof self !== "undefined" ? self :
19761 typeof window !== "undefined" ? window :
19762 typeof global !== "undefined" ? global :
19763 this !== undefined ? this : null;
19765 function tryCatcher() {
19767 var target = tryCatchTarget;
19768 tryCatchTarget = null;
19769 return target.apply(this, arguments);
19775 function tryCatch(fn) {
19776 tryCatchTarget = fn;
19780 var inherits = function(Child, Parent) {
19781 var hasProp = {}.hasOwnProperty;
19784 this.constructor = Child;
19785 this.constructor$ = Parent;
19786 for (var propertyName in Parent.prototype) {
19787 if (hasProp.call(Parent.prototype, propertyName) &&
19788 propertyName.charAt(propertyName.length-1) !== "$"
19790 this[propertyName + "$"] = Parent.prototype[propertyName];
19794 T.prototype = Parent.prototype;
19795 Child.prototype = new T();
19796 return Child.prototype;
19800 function isPrimitive(val) {
19801 return val == null || val === true || val === false ||
19802 typeof val === "string" || typeof val === "number";
19806 function isObject(value) {
19807 return typeof value === "function" ||
19808 typeof value === "object" && value !== null;
19811 function maybeWrapAsError(maybeError) {
19812 if (!isPrimitive(maybeError)) return maybeError;
19814 return new Error(safeToString(maybeError));
19817 function withAppended(target, appendee) {
19818 var len = target.length;
19819 var ret = new Array(len + 1);
19821 for (i = 0; i < len; ++i) {
19822 ret[i] = target[i];
19828 function getDataPropertyOrDefault(obj, key, defaultValue) {
19830 var desc = Object.getOwnPropertyDescriptor(obj, key);
19832 if (desc != null) {
19833 return desc.get == null && desc.set == null
19838 return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
19842 function notEnumerableProp(obj, name, value) {
19843 if (isPrimitive(obj)) return obj;
19846 configurable: true,
19850 es5.defineProperty(obj, name, descriptor);
19854 function thrower(r) {
19858 var inheritedDataKeys = (function() {
19859 var excludedPrototypes = [
19865 var isExcludedProto = function(val) {
19866 for (var i = 0; i < excludedPrototypes.length; ++i) {
19867 if (excludedPrototypes[i] === val) {
19875 var getKeys = Object.getOwnPropertyNames;
19876 return function(obj) {
19878 var visitedKeys = Object.create(null);
19879 while (obj != null && !isExcludedProto(obj)) {
19882 keys = getKeys(obj);
19886 for (var i = 0; i < keys.length; ++i) {
19888 if (visitedKeys[key]) continue;
19889 visitedKeys[key] = true;
19890 var desc = Object.getOwnPropertyDescriptor(obj, key);
19891 if (desc != null && desc.get == null && desc.set == null) {
19895 obj = es5.getPrototypeOf(obj);
19900 var hasProp = {}.hasOwnProperty;
19901 return function(obj) {
19902 if (isExcludedProto(obj)) return [];
19905 /*jshint forin:false */
19906 enumeration: for (var key in obj) {
19907 if (hasProp.call(obj, key)) {
19910 for (var i = 0; i < excludedPrototypes.length; ++i) {
19911 if (hasProp.call(excludedPrototypes[i], key)) {
19912 continue enumeration;
19924 var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
19925 function isClass(fn) {
19927 if (typeof fn === "function") {
19928 var keys = es5.names(fn.prototype);
19930 var hasMethods = es5.isES5 && keys.length > 1;
19931 var hasMethodsOtherThanConstructor = keys.length > 0 &&
19932 !(keys.length === 1 && keys[0] === "constructor");
19933 var hasThisAssignmentAndStaticMethods =
19934 thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
19936 if (hasMethods || hasMethodsOtherThanConstructor ||
19937 hasThisAssignmentAndStaticMethods) {
19947 function toFastProperties(obj) {
19948 /*jshint -W027,-W055,-W031*/
19949 function FakeConstructor() {}
19950 FakeConstructor.prototype = obj;
19952 while (l--) new FakeConstructor();
19957 var rident = /^[a-z$_][a-z$_0-9]*$/i;
19958 function isIdentifier(str) {
19959 return rident.test(str);
19962 function filledRange(count, prefix, suffix) {
19963 var ret = new Array(count);
19964 for(var i = 0; i < count; ++i) {
19965 ret[i] = prefix + i + suffix;
19970 function safeToString(obj) {
19974 return "[no string representation]";
19978 function isError(obj) {
19979 return obj !== null &&
19980 typeof obj === "object" &&
19981 typeof obj.message === "string" &&
19982 typeof obj.name === "string";
19985 function markAsOriginatingFromRejection(e) {
19987 notEnumerableProp(e, "isOperational", true);
19992 function originatesFromRejection(e) {
19993 if (e == null) return false;
19994 return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
19995 e["isOperational"] === true);
19998 function canAttachTrace(obj) {
19999 return isError(obj) && es5.propertyIsWritable(obj, "stack");
20002 var ensureErrorObject = (function() {
20003 if (!("stack" in new Error())) {
20004 return function(value) {
20005 if (canAttachTrace(value)) return value;
20006 try {throw new Error(safeToString(value));}
20007 catch(err) {return err;}
20010 return function(value) {
20011 if (canAttachTrace(value)) return value;
20012 return new Error(safeToString(value));
20017 function classString(obj) {
20018 return {}.toString.call(obj);
20021 function copyDescriptors(from, to, filter) {
20022 var keys = es5.names(from);
20023 for (var i = 0; i < keys.length; ++i) {
20027 es5.defineProperty(to, key, es5.getDescriptor(from, key));
20028 } catch (ignore) {}
20033 var asArray = function(v) {
20034 if (es5.isArray(v)) {
20040 if (typeof Symbol !== "undefined" && Symbol.iterator) {
20041 var ArrayFrom = typeof Array.from === "function" ? function(v) {
20042 return Array.from(v);
20045 var it = v[Symbol.iterator]();
20047 while (!((itResult = it.next()).done)) {
20048 ret.push(itResult.value);
20053 asArray = function(v) {
20054 if (es5.isArray(v)) {
20056 } else if (v != null && typeof v[Symbol.iterator] === "function") {
20057 return ArrayFrom(v);
20063 var isNode = typeof process !== "undefined" &&
20064 classString(process).toLowerCase() === "[object process]";
20066 var hasEnvVariables = typeof process !== "undefined" &&
20067 typeof process.env !== "undefined";
20069 function env(key) {
20070 return hasEnvVariables ? process.env[key] : undefined;
20073 function getNativePromise() {
20074 if (typeof Promise === "function") {
20076 var promise = new Promise(function(){});
20077 if ({}.toString.call(promise) === "[object Promise]") {
20084 function domainBind(self, cb) {
20085 return self.bind(cb);
20090 isIdentifier: isIdentifier,
20091 inheritedDataKeys: inheritedDataKeys,
20092 getDataPropertyOrDefault: getDataPropertyOrDefault,
20094 isArray: es5.isArray,
20096 notEnumerableProp: notEnumerableProp,
20097 isPrimitive: isPrimitive,
20098 isObject: isObject,
20100 canEvaluate: canEvaluate,
20101 errorObj: errorObj,
20102 tryCatch: tryCatch,
20103 inherits: inherits,
20104 withAppended: withAppended,
20105 maybeWrapAsError: maybeWrapAsError,
20106 toFastProperties: toFastProperties,
20107 filledRange: filledRange,
20108 toString: safeToString,
20109 canAttachTrace: canAttachTrace,
20110 ensureErrorObject: ensureErrorObject,
20111 originatesFromRejection: originatesFromRejection,
20112 markAsOriginatingFromRejection: markAsOriginatingFromRejection,
20113 classString: classString,
20114 copyDescriptors: copyDescriptors,
20115 hasDevTools: typeof chrome !== "undefined" && chrome &&
20116 typeof chrome.loadTimes === "function",
20118 hasEnvVariables: hasEnvVariables,
20120 global: globalObject,
20121 getNativePromise: getNativePromise,
20122 domainBind: domainBind
20124 ret.isRecentNode = ret.isNode && (function() {
20125 var version = process.versions.node.split(".").map(Number);
20126 return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
20129 if (ret.isNode) ret.toFastProperties(process);
20131 try {throw new Error(); } catch (e) {ret.lastLineError = e;}
20132 module.exports = ret;
20137 /***/ ((module) => {
20139 var isES5 = (function(){
20141 return this === undefined;
20146 freeze: Object.freeze,
20147 defineProperty: Object.defineProperty,
20148 getDescriptor: Object.getOwnPropertyDescriptor,
20150 names: Object.getOwnPropertyNames,
20151 getPrototypeOf: Object.getPrototypeOf,
20152 isArray: Array.isArray,
20154 propertyIsWritable: function(obj, prop) {
20155 var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
20156 return !!(!descriptor || descriptor.writable || descriptor.set);
20160 var has = {}.hasOwnProperty;
20161 var str = {}.toString;
20162 var proto = {}.constructor.prototype;
20164 var ObjectKeys = function (o) {
20166 for (var key in o) {
20167 if (has.call(o, key)) {
20174 var ObjectGetDescriptor = function(o, key) {
20175 return {value: o[key]};
20178 var ObjectDefineProperty = function (o, key, desc) {
20179 o[key] = desc.value;
20183 var ObjectFreeze = function (obj) {
20187 var ObjectGetPrototypeOf = function (obj) {
20189 return Object(obj).constructor.prototype;
20196 var ArrayIsArray = function (obj) {
20198 return str.call(obj) === "[object Array]";
20206 isArray: ArrayIsArray,
20209 defineProperty: ObjectDefineProperty,
20210 getDescriptor: ObjectGetDescriptor,
20211 freeze: ObjectFreeze,
20212 getPrototypeOf: ObjectGetPrototypeOf,
20214 propertyIsWritable: function() {
20223 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20227 var firstLineError;
20228 try {throw new Error(); } catch (e) {firstLineError = e;}
20229 var schedule = __webpack_require__(133);
20230 var Queue = __webpack_require__(134);
20231 var util = __webpack_require__(130);
20234 this._customScheduler = false;
20235 this._isTickUsed = false;
20236 this._lateQueue = new Queue(16);
20237 this._normalQueue = new Queue(16);
20238 this._haveDrainedQueues = false;
20239 this._trampolineEnabled = true;
20241 this.drainQueues = function () {
20242 self._drainQueues();
20244 this._schedule = schedule;
20247 Async.prototype.setScheduler = function(fn) {
20248 var prev = this._schedule;
20249 this._schedule = fn;
20250 this._customScheduler = true;
20254 Async.prototype.hasCustomScheduler = function() {
20255 return this._customScheduler;
20258 Async.prototype.enableTrampoline = function() {
20259 this._trampolineEnabled = true;
20262 Async.prototype.disableTrampolineIfNecessary = function() {
20263 if (util.hasDevTools) {
20264 this._trampolineEnabled = false;
20268 Async.prototype.haveItemsQueued = function () {
20269 return this._isTickUsed || this._haveDrainedQueues;
20273 Async.prototype.fatalError = function(e, isNode) {
20275 process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
20279 this.throwLater(e);
20283 Async.prototype.throwLater = function(fn, arg) {
20284 if (arguments.length === 1) {
20286 fn = function () { throw arg; };
20288 if (typeof setTimeout !== "undefined") {
20289 setTimeout(function() {
20293 this._schedule(function() {
20297 throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
20301 function AsyncInvokeLater(fn, receiver, arg) {
20302 this._lateQueue.push(fn, receiver, arg);
20306 function AsyncInvoke(fn, receiver, arg) {
20307 this._normalQueue.push(fn, receiver, arg);
20311 function AsyncSettlePromises(promise) {
20312 this._normalQueue._pushOne(promise);
20316 if (!util.hasDevTools) {
20317 Async.prototype.invokeLater = AsyncInvokeLater;
20318 Async.prototype.invoke = AsyncInvoke;
20319 Async.prototype.settlePromises = AsyncSettlePromises;
20321 Async.prototype.invokeLater = function (fn, receiver, arg) {
20322 if (this._trampolineEnabled) {
20323 AsyncInvokeLater.call(this, fn, receiver, arg);
20325 this._schedule(function() {
20326 setTimeout(function() {
20327 fn.call(receiver, arg);
20333 Async.prototype.invoke = function (fn, receiver, arg) {
20334 if (this._trampolineEnabled) {
20335 AsyncInvoke.call(this, fn, receiver, arg);
20337 this._schedule(function() {
20338 fn.call(receiver, arg);
20343 Async.prototype.settlePromises = function(promise) {
20344 if (this._trampolineEnabled) {
20345 AsyncSettlePromises.call(this, promise);
20347 this._schedule(function() {
20348 promise._settlePromises();
20354 Async.prototype._drainQueue = function(queue) {
20355 while (queue.length() > 0) {
20356 var fn = queue.shift();
20357 if (typeof fn !== "function") {
20358 fn._settlePromises();
20361 var receiver = queue.shift();
20362 var arg = queue.shift();
20363 fn.call(receiver, arg);
20367 Async.prototype._drainQueues = function () {
20368 this._drainQueue(this._normalQueue);
20370 this._haveDrainedQueues = true;
20371 this._drainQueue(this._lateQueue);
20374 Async.prototype._queueTick = function () {
20375 if (!this._isTickUsed) {
20376 this._isTickUsed = true;
20377 this._schedule(this.drainQueues);
20381 Async.prototype._reset = function () {
20382 this._isTickUsed = false;
20385 module.exports = Async;
20386 module.exports.firstLineError = firstLineError;
20391 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20395 var util = __webpack_require__(130);
20397 var noAsyncScheduler = function() {
20398 throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
20400 var NativePromise = util.getNativePromise();
20401 if (util.isNode && typeof MutationObserver === "undefined") {
20402 var GlobalSetImmediate = global.setImmediate;
20403 var ProcessNextTick = process.nextTick;
20404 schedule = util.isRecentNode
20405 ? function(fn) { GlobalSetImmediate.call(global, fn); }
20406 : function(fn) { ProcessNextTick.call(process, fn); };
20407 } else if (typeof NativePromise === "function" &&
20408 typeof NativePromise.resolve === "function") {
20409 var nativePromise = NativePromise.resolve();
20410 schedule = function(fn) {
20411 nativePromise.then(fn);
20413 } else if ((typeof MutationObserver !== "undefined") &&
20414 !(typeof window !== "undefined" &&
20415 window.navigator &&
20416 (window.navigator.standalone || window.cordova))) {
20417 schedule = (function() {
20418 var div = document.createElement("div");
20419 var opts = {attributes: true};
20420 var toggleScheduled = false;
20421 var div2 = document.createElement("div");
20422 var o2 = new MutationObserver(function() {
20423 div.classList.toggle("foo");
20424 toggleScheduled = false;
20426 o2.observe(div2, opts);
20428 var scheduleToggle = function() {
20429 if (toggleScheduled) return;
20430 toggleScheduled = true;
20431 div2.classList.toggle("foo");
20434 return function schedule(fn) {
20435 var o = new MutationObserver(function() {
20439 o.observe(div, opts);
20443 } else if (typeof setImmediate !== "undefined") {
20444 schedule = function (fn) {
20447 } else if (typeof setTimeout !== "undefined") {
20448 schedule = function (fn) {
20452 schedule = noAsyncScheduler;
20454 module.exports = schedule;
20459 /***/ ((module) => {
20463 function arrayMove(src, srcIndex, dst, dstIndex, len) {
20464 for (var j = 0; j < len; ++j) {
20465 dst[j + dstIndex] = src[j + srcIndex];
20466 src[j + srcIndex] = void 0;
20470 function Queue(capacity) {
20471 this._capacity = capacity;
20476 Queue.prototype._willBeOverCapacity = function (size) {
20477 return this._capacity < size;
20480 Queue.prototype._pushOne = function (arg) {
20481 var length = this.length();
20482 this._checkCapacity(length + 1);
20483 var i = (this._front + length) & (this._capacity - 1);
20485 this._length = length + 1;
20488 Queue.prototype.push = function (fn, receiver, arg) {
20489 var length = this.length() + 3;
20490 if (this._willBeOverCapacity(length)) {
20492 this._pushOne(receiver);
20493 this._pushOne(arg);
20496 var j = this._front + length - 3;
20497 this._checkCapacity(length);
20498 var wrapMask = this._capacity - 1;
20499 this[(j + 0) & wrapMask] = fn;
20500 this[(j + 1) & wrapMask] = receiver;
20501 this[(j + 2) & wrapMask] = arg;
20502 this._length = length;
20505 Queue.prototype.shift = function () {
20506 var front = this._front,
20509 this[front] = undefined;
20510 this._front = (front + 1) & (this._capacity - 1);
20515 Queue.prototype.length = function () {
20516 return this._length;
20519 Queue.prototype._checkCapacity = function (size) {
20520 if (this._capacity < size) {
20521 this._resizeTo(this._capacity << 1);
20525 Queue.prototype._resizeTo = function (capacity) {
20526 var oldCapacity = this._capacity;
20527 this._capacity = capacity;
20528 var front = this._front;
20529 var length = this._length;
20530 var moveItemsCount = (front + length) & (oldCapacity - 1);
20531 arrayMove(this, 0, this, oldCapacity, moveItemsCount);
20534 module.exports = Queue;
20539 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20543 var es5 = __webpack_require__(131);
20544 var Objectfreeze = es5.freeze;
20545 var util = __webpack_require__(130);
20546 var inherits = util.inherits;
20547 var notEnumerableProp = util.notEnumerableProp;
20549 function subError(nameProperty, defaultMessage) {
20550 function SubError(message) {
20551 if (!(this instanceof SubError)) return new SubError(message);
20552 notEnumerableProp(this, "message",
20553 typeof message === "string" ? message : defaultMessage);
20554 notEnumerableProp(this, "name", nameProperty);
20555 if (Error.captureStackTrace) {
20556 Error.captureStackTrace(this, this.constructor);
20561 inherits(SubError, Error);
20565 var _TypeError, _RangeError;
20566 var Warning = subError("Warning", "warning");
20567 var CancellationError = subError("CancellationError", "cancellation error");
20568 var TimeoutError = subError("TimeoutError", "timeout error");
20569 var AggregateError = subError("AggregateError", "aggregate error");
20571 _TypeError = TypeError;
20572 _RangeError = RangeError;
20574 _TypeError = subError("TypeError", "type error");
20575 _RangeError = subError("RangeError", "range error");
20578 var methods = ("join pop push shift unshift slice filter forEach some " +
20579 "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
20581 for (var i = 0; i < methods.length; ++i) {
20582 if (typeof Array.prototype[methods[i]] === "function") {
20583 AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
20587 es5.defineProperty(AggregateError.prototype, "length", {
20589 configurable: false,
20593 AggregateError.prototype["isOperational"] = true;
20595 AggregateError.prototype.toString = function() {
20596 var indent = Array(level * 4 + 1).join(" ");
20597 var ret = "\n" + indent + "AggregateError of:" + "\n";
20599 indent = Array(level * 4 + 1).join(" ");
20600 for (var i = 0; i < this.length; ++i) {
20601 var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
20602 var lines = str.split("\n");
20603 for (var j = 0; j < lines.length; ++j) {
20604 lines[j] = indent + lines[j];
20606 str = lines.join("\n");
20613 function OperationalError(message) {
20614 if (!(this instanceof OperationalError))
20615 return new OperationalError(message);
20616 notEnumerableProp(this, "name", "OperationalError");
20617 notEnumerableProp(this, "message", message);
20618 this.cause = message;
20619 this["isOperational"] = true;
20621 if (message instanceof Error) {
20622 notEnumerableProp(this, "message", message.message);
20623 notEnumerableProp(this, "stack", message.stack);
20624 } else if (Error.captureStackTrace) {
20625 Error.captureStackTrace(this, this.constructor);
20629 inherits(OperationalError, Error);
20631 var errorTypes = Error["__BluebirdErrorTypes__"];
20633 errorTypes = Objectfreeze({
20634 CancellationError: CancellationError,
20635 TimeoutError: TimeoutError,
20636 OperationalError: OperationalError,
20637 RejectionError: OperationalError,
20638 AggregateError: AggregateError
20640 es5.defineProperty(Error, "__BluebirdErrorTypes__", {
20644 configurable: false
20650 TypeError: _TypeError,
20651 RangeError: _RangeError,
20652 CancellationError: errorTypes.CancellationError,
20653 OperationalError: errorTypes.OperationalError,
20654 TimeoutError: errorTypes.TimeoutError,
20655 AggregateError: errorTypes.AggregateError,
20662 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20666 module.exports = function(Promise, INTERNAL) {
20667 var util = __webpack_require__(130);
20668 var errorObj = util.errorObj;
20669 var isObject = util.isObject;
20671 function tryConvertToPromise(obj, context) {
20672 if (isObject(obj)) {
20673 if (obj instanceof Promise) return obj;
20674 var then = getThen(obj);
20675 if (then === errorObj) {
20676 if (context) context._pushContext();
20677 var ret = Promise.reject(then.e);
20678 if (context) context._popContext();
20680 } else if (typeof then === "function") {
20681 if (isAnyBluebirdPromise(obj)) {
20682 var ret = new Promise(INTERNAL);
20692 return doThenable(obj, then, context);
20698 function doGetThen(obj) {
20702 function getThen(obj) {
20704 return doGetThen(obj);
20711 var hasProp = {}.hasOwnProperty;
20712 function isAnyBluebirdPromise(obj) {
20714 return hasProp.call(obj, "_promise0");
20720 function doThenable(x, then, context) {
20721 var promise = new Promise(INTERNAL);
20723 if (context) context._pushContext();
20724 promise._captureStackTrace();
20725 if (context) context._popContext();
20726 var synchronous = true;
20727 var result = util.tryCatch(then).call(x, resolve, reject);
20728 synchronous = false;
20730 if (promise && result === errorObj) {
20731 promise._rejectCallback(result.e, true, true);
20735 function resolve(value) {
20736 if (!promise) return;
20737 promise._resolveCallback(value);
20741 function reject(reason) {
20742 if (!promise) return;
20743 promise._rejectCallback(reason, synchronous, true);
20749 return tryConvertToPromise;
20755 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
20759 module.exports = function(Promise, INTERNAL, tryConvertToPromise,
20760 apiRejection, Proxyable) {
20761 var util = __webpack_require__(130);
20762 var isArray = util.isArray;
20764 function toResolutionValue(val) {
20766 case -2: return [];
20767 case -3: return {};
20771 function PromiseArray(values) {
20772 var promise = this._promise = new Promise(INTERNAL);
20773 if (values instanceof Promise) {
20774 promise._propagateFrom(values, 3);
20776 promise._setOnCancel(this);
20777 this._values = values;
20779 this._totalResolved = 0;
20780 this._init(undefined, -2);
20782 util.inherits(PromiseArray, Proxyable);
20784 PromiseArray.prototype.length = function () {
20785 return this._length;
20788 PromiseArray.prototype.promise = function () {
20789 return this._promise;
20792 PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
20793 var values = tryConvertToPromise(this._values, this._promise);
20794 if (values instanceof Promise) {
20795 values = values._target();
20796 var bitField = values._bitField;
20798 this._values = values;
20800 if (((bitField & 50397184) === 0)) {
20801 this._promise._setAsyncGuaranteed();
20802 return values._then(
20807 resolveValueIfEmpty
20809 } else if (((bitField & 33554432) !== 0)) {
20810 values = values._value();
20811 } else if (((bitField & 16777216) !== 0)) {
20812 return this._reject(values._reason());
20814 return this._cancel();
20817 values = util.asArray(values);
20818 if (values === null) {
20819 var err = apiRejection(
20820 "expecting an array or an iterable object but got " + util.classString(values)).reason();
20821 this._promise._rejectCallback(err, false);
20825 if (values.length === 0) {
20826 if (resolveValueIfEmpty === -5) {
20827 this._resolveEmptyArray();
20830 this._resolve(toResolutionValue(resolveValueIfEmpty));
20834 this._iterate(values);
20837 PromiseArray.prototype._iterate = function(values) {
20838 var len = this.getActualLength(values.length);
20839 this._length = len;
20840 this._values = this.shouldCopyValues() ? new Array(len) : this._values;
20841 var result = this._promise;
20842 var isResolved = false;
20843 var bitField = null;
20844 for (var i = 0; i < len; ++i) {
20845 var maybePromise = tryConvertToPromise(values[i], result);
20847 if (maybePromise instanceof Promise) {
20848 maybePromise = maybePromise._target();
20849 bitField = maybePromise._bitField;
20855 if (bitField !== null) {
20856 maybePromise.suppressUnhandledRejections();
20858 } else if (bitField !== null) {
20859 if (((bitField & 50397184) === 0)) {
20860 maybePromise._proxy(this, i);
20861 this._values[i] = maybePromise;
20862 } else if (((bitField & 33554432) !== 0)) {
20863 isResolved = this._promiseFulfilled(maybePromise._value(), i);
20864 } else if (((bitField & 16777216) !== 0)) {
20865 isResolved = this._promiseRejected(maybePromise._reason(), i);
20867 isResolved = this._promiseCancelled(i);
20870 isResolved = this._promiseFulfilled(maybePromise, i);
20873 if (!isResolved) result._setAsyncGuaranteed();
20876 PromiseArray.prototype._isResolved = function () {
20877 return this._values === null;
20880 PromiseArray.prototype._resolve = function (value) {
20881 this._values = null;
20882 this._promise._fulfill(value);
20885 PromiseArray.prototype._cancel = function() {
20886 if (this._isResolved() || !this._promise._isCancellable()) return;
20887 this._values = null;
20888 this._promise._cancel();
20891 PromiseArray.prototype._reject = function (reason) {
20892 this._values = null;
20893 this._promise._rejectCallback(reason, false);
20896 PromiseArray.prototype._promiseFulfilled = function (value, index) {
20897 this._values[index] = value;
20898 var totalResolved = ++this._totalResolved;
20899 if (totalResolved >= this._length) {
20900 this._resolve(this._values);
20906 PromiseArray.prototype._promiseCancelled = function() {
20911 PromiseArray.prototype._promiseRejected = function (reason) {
20912 this._totalResolved++;
20913 this._reject(reason);
20917 PromiseArray.prototype._resultCancelled = function() {
20918 if (this._isResolved()) return;
20919 var values = this._values;
20921 if (values instanceof Promise) {
20924 for (var i = 0; i < values.length; ++i) {
20925 if (values[i] instanceof Promise) {
20926 values[i].cancel();
20932 PromiseArray.prototype.shouldCopyValues = function () {
20936 PromiseArray.prototype.getActualLength = function (len) {
20940 return PromiseArray;
20946 /***/ ((module) => {
20950 module.exports = function(Promise) {
20951 var longStackTraces = false;
20952 var contextStack = [];
20954 Promise.prototype._promiseCreated = function() {};
20955 Promise.prototype._pushContext = function() {};
20956 Promise.prototype._popContext = function() {return null;};
20957 Promise._peekContext = Promise.prototype._peekContext = function() {};
20959 function Context() {
20960 this._trace = new Context.CapturedTrace(peekContext());
20962 Context.prototype._pushContext = function () {
20963 if (this._trace !== undefined) {
20964 this._trace._promiseCreated = null;
20965 contextStack.push(this._trace);
20969 Context.prototype._popContext = function () {
20970 if (this._trace !== undefined) {
20971 var trace = contextStack.pop();
20972 var ret = trace._promiseCreated;
20973 trace._promiseCreated = null;
20979 function createContext() {
20980 if (longStackTraces) return new Context();
20983 function peekContext() {
20984 var lastIndex = contextStack.length - 1;
20985 if (lastIndex >= 0) {
20986 return contextStack[lastIndex];
20990 Context.CapturedTrace = null;
20991 Context.create = createContext;
20992 Context.deactivateLongStackTraces = function() {};
20993 Context.activateLongStackTraces = function() {
20994 var Promise_pushContext = Promise.prototype._pushContext;
20995 var Promise_popContext = Promise.prototype._popContext;
20996 var Promise_PeekContext = Promise._peekContext;
20997 var Promise_peekContext = Promise.prototype._peekContext;
20998 var Promise_promiseCreated = Promise.prototype._promiseCreated;
20999 Context.deactivateLongStackTraces = function() {
21000 Promise.prototype._pushContext = Promise_pushContext;
21001 Promise.prototype._popContext = Promise_popContext;
21002 Promise._peekContext = Promise_PeekContext;
21003 Promise.prototype._peekContext = Promise_peekContext;
21004 Promise.prototype._promiseCreated = Promise_promiseCreated;
21005 longStackTraces = false;
21007 longStackTraces = true;
21008 Promise.prototype._pushContext = Context.prototype._pushContext;
21009 Promise.prototype._popContext = Context.prototype._popContext;
21010 Promise._peekContext = Promise.prototype._peekContext = peekContext;
21011 Promise.prototype._promiseCreated = function() {
21012 var ctx = this._peekContext();
21013 if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
21022 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
21026 module.exports = function(Promise, Context) {
21027 var getDomain = Promise._getDomain;
21028 var async = Promise._async;
21029 var Warning = __webpack_require__(135).Warning;
21030 var util = __webpack_require__(130);
21031 var canAttachTrace = util.canAttachTrace;
21032 var unhandledRejectionHandled;
21033 var possiblyUnhandledRejection;
21034 var bluebirdFramePattern =
21035 /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
21036 var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
21037 var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
21038 var stackFramePattern = null;
21039 var formatStack = null;
21040 var indentStackFrames = false;
21042 var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 &&
21044 util.env("BLUEBIRD_DEBUG") ||
21045 util.env("NODE_ENV") === "development"));
21047 var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 &&
21048 (debugging || util.env("BLUEBIRD_WARNINGS")));
21050 var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
21051 (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
21053 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
21054 (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
21056 Promise.prototype.suppressUnhandledRejections = function() {
21057 var target = this._target();
21058 target._bitField = ((target._bitField & (~1048576)) |
21062 Promise.prototype._ensurePossibleRejectionHandled = function () {
21063 if ((this._bitField & 524288) !== 0) return;
21064 this._setRejectionIsUnhandled();
21065 async.invokeLater(this._notifyUnhandledRejection, this, undefined);
21068 Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
21069 fireRejectionEvent("rejectionHandled",
21070 unhandledRejectionHandled, undefined, this);
21073 Promise.prototype._setReturnedNonUndefined = function() {
21074 this._bitField = this._bitField | 268435456;
21077 Promise.prototype._returnedNonUndefined = function() {
21078 return (this._bitField & 268435456) !== 0;
21081 Promise.prototype._notifyUnhandledRejection = function () {
21082 if (this._isRejectionUnhandled()) {
21083 var reason = this._settledValue();
21084 this._setUnhandledRejectionIsNotified();
21085 fireRejectionEvent("unhandledRejection",
21086 possiblyUnhandledRejection, reason, this);
21090 Promise.prototype._setUnhandledRejectionIsNotified = function () {
21091 this._bitField = this._bitField | 262144;
21094 Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
21095 this._bitField = this._bitField & (~262144);
21098 Promise.prototype._isUnhandledRejectionNotified = function () {
21099 return (this._bitField & 262144) > 0;
21102 Promise.prototype._setRejectionIsUnhandled = function () {
21103 this._bitField = this._bitField | 1048576;
21106 Promise.prototype._unsetRejectionIsUnhandled = function () {
21107 this._bitField = this._bitField & (~1048576);
21108 if (this._isUnhandledRejectionNotified()) {
21109 this._unsetUnhandledRejectionIsNotified();
21110 this._notifyUnhandledRejectionIsHandled();
21114 Promise.prototype._isRejectionUnhandled = function () {
21115 return (this._bitField & 1048576) > 0;
21118 Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
21119 return warn(message, shouldUseOwnTrace, promise || this);
21122 Promise.onPossiblyUnhandledRejection = function (fn) {
21123 var domain = getDomain();
21124 possiblyUnhandledRejection =
21125 typeof fn === "function" ? (domain === null ?
21126 fn : util.domainBind(domain, fn))
21130 Promise.onUnhandledRejectionHandled = function (fn) {
21131 var domain = getDomain();
21132 unhandledRejectionHandled =
21133 typeof fn === "function" ? (domain === null ?
21134 fn : util.domainBind(domain, fn))
21138 var disableLongStackTraces = function() {};
21139 Promise.longStackTraces = function () {
21140 if (async.haveItemsQueued() && !config.longStackTraces) {
21141 throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
21143 if (!config.longStackTraces && longStackTracesIsSupported()) {
21144 var Promise_captureStackTrace = Promise.prototype._captureStackTrace;
21145 var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;
21146 config.longStackTraces = true;
21147 disableLongStackTraces = function() {
21148 if (async.haveItemsQueued() && !config.longStackTraces) {
21149 throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
21151 Promise.prototype._captureStackTrace = Promise_captureStackTrace;
21152 Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
21153 Context.deactivateLongStackTraces();
21154 async.enableTrampoline();
21155 config.longStackTraces = false;
21157 Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
21158 Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
21159 Context.activateLongStackTraces();
21160 async.disableTrampolineIfNecessary();
21164 Promise.hasLongStackTraces = function () {
21165 return config.longStackTraces && longStackTracesIsSupported();
21168 var fireDomEvent = (function() {
21170 if (typeof CustomEvent === "function") {
21171 var event = new CustomEvent("CustomEvent");
21172 util.global.dispatchEvent(event);
21173 return function(name, event) {
21174 var domEvent = new CustomEvent(name.toLowerCase(), {
21178 return !util.global.dispatchEvent(domEvent);
21180 } else if (typeof Event === "function") {
21181 var event = new Event("CustomEvent");
21182 util.global.dispatchEvent(event);
21183 return function(name, event) {
21184 var domEvent = new Event(name.toLowerCase(), {
21187 domEvent.detail = event;
21188 return !util.global.dispatchEvent(domEvent);
21191 var event = document.createEvent("CustomEvent");
21192 event.initCustomEvent("testingtheevent", false, true, {});
21193 util.global.dispatchEvent(event);
21194 return function(name, event) {
21195 var domEvent = document.createEvent("CustomEvent");
21196 domEvent.initCustomEvent(name.toLowerCase(), false, true,
21198 return !util.global.dispatchEvent(domEvent);
21202 return function() {
21207 var fireGlobalEvent = (function() {
21209 return function() {
21210 return process.emit.apply(process, arguments);
21213 if (!util.global) {
21214 return function() {
21218 return function(name) {
21219 var methodName = "on" + name.toLowerCase();
21220 var method = util.global[methodName];
21221 if (!method) return false;
21222 method.apply(util.global, [].slice.call(arguments, 1));
21228 function generatePromiseLifecycleEventObject(name, promise) {
21229 return {promise: promise};
21232 var eventToObjectGenerator = {
21233 promiseCreated: generatePromiseLifecycleEventObject,
21234 promiseFulfilled: generatePromiseLifecycleEventObject,
21235 promiseRejected: generatePromiseLifecycleEventObject,
21236 promiseResolved: generatePromiseLifecycleEventObject,
21237 promiseCancelled: generatePromiseLifecycleEventObject,
21238 promiseChained: function(name, promise, child) {
21239 return {promise: promise, child: child};
21241 warning: function(name, warning) {
21242 return {warning: warning};
21244 unhandledRejection: function (name, reason, promise) {
21245 return {reason: reason, promise: promise};
21247 rejectionHandled: generatePromiseLifecycleEventObject
21250 var activeFireEvent = function (name) {
21251 var globalEventFired = false;
21253 globalEventFired = fireGlobalEvent.apply(null, arguments);
21255 async.throwLater(e);
21256 globalEventFired = true;
21259 var domEventFired = false;
21261 domEventFired = fireDomEvent(name,
21262 eventToObjectGenerator[name].apply(null, arguments));
21264 async.throwLater(e);
21265 domEventFired = true;
21268 return domEventFired || globalEventFired;
21271 Promise.config = function(opts) {
21272 opts = Object(opts);
21273 if ("longStackTraces" in opts) {
21274 if (opts.longStackTraces) {
21275 Promise.longStackTraces();
21276 } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {
21277 disableLongStackTraces();
21280 if ("warnings" in opts) {
21281 var warningsOption = opts.warnings;
21282 config.warnings = !!warningsOption;
21283 wForgottenReturn = config.warnings;
21285 if (util.isObject(warningsOption)) {
21286 if ("wForgottenReturn" in warningsOption) {
21287 wForgottenReturn = !!warningsOption.wForgottenReturn;
21291 if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
21292 if (async.haveItemsQueued()) {
21294 "cannot enable cancellation after promises are in use");
21296 Promise.prototype._clearCancellationData =
21297 cancellationClearCancellationData;
21298 Promise.prototype._propagateFrom = cancellationPropagateFrom;
21299 Promise.prototype._onCancel = cancellationOnCancel;
21300 Promise.prototype._setOnCancel = cancellationSetOnCancel;
21301 Promise.prototype._attachCancellationCallback =
21302 cancellationAttachCancellationCallback;
21303 Promise.prototype._execute = cancellationExecute;
21304 propagateFromFunction = cancellationPropagateFrom;
21305 config.cancellation = true;
21307 if ("monitoring" in opts) {
21308 if (opts.monitoring && !config.monitoring) {
21309 config.monitoring = true;
21310 Promise.prototype._fireEvent = activeFireEvent;
21311 } else if (!opts.monitoring && config.monitoring) {
21312 config.monitoring = false;
21313 Promise.prototype._fireEvent = defaultFireEvent;
21319 function defaultFireEvent() { return false; }
21321 Promise.prototype._fireEvent = defaultFireEvent;
21322 Promise.prototype._execute = function(executor, resolve, reject) {
21324 executor(resolve, reject);
21329 Promise.prototype._onCancel = function () {};
21330 Promise.prototype._setOnCancel = function (handler) { ; };
21331 Promise.prototype._attachCancellationCallback = function(onCancel) {
21334 Promise.prototype._captureStackTrace = function () {};
21335 Promise.prototype._attachExtraTrace = function () {};
21336 Promise.prototype._clearCancellationData = function() {};
21337 Promise.prototype._propagateFrom = function (parent, flags) {
21342 function cancellationExecute(executor, resolve, reject) {
21343 var promise = this;
21345 executor(resolve, reject, function(onCancel) {
21346 if (typeof onCancel !== "function") {
21347 throw new TypeError("onCancel must be a function, got: " +
21348 util.toString(onCancel));
21350 promise._attachCancellationCallback(onCancel);
21357 function cancellationAttachCancellationCallback(onCancel) {
21358 if (!this._isCancellable()) return this;
21360 var previousOnCancel = this._onCancel();
21361 if (previousOnCancel !== undefined) {
21362 if (util.isArray(previousOnCancel)) {
21363 previousOnCancel.push(onCancel);
21365 this._setOnCancel([previousOnCancel, onCancel]);
21368 this._setOnCancel(onCancel);
21372 function cancellationOnCancel() {
21373 return this._onCancelField;
21376 function cancellationSetOnCancel(onCancel) {
21377 this._onCancelField = onCancel;
21380 function cancellationClearCancellationData() {
21381 this._cancellationParent = undefined;
21382 this._onCancelField = undefined;
21385 function cancellationPropagateFrom(parent, flags) {
21386 if ((flags & 1) !== 0) {
21387 this._cancellationParent = parent;
21388 var branchesRemainingToCancel = parent._branchesRemainingToCancel;
21389 if (branchesRemainingToCancel === undefined) {
21390 branchesRemainingToCancel = 0;
21392 parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
21394 if ((flags & 2) !== 0 && parent._isBound()) {
21395 this._setBoundTo(parent._boundTo);
21399 function bindingPropagateFrom(parent, flags) {
21400 if ((flags & 2) !== 0 && parent._isBound()) {
21401 this._setBoundTo(parent._boundTo);
21404 var propagateFromFunction = bindingPropagateFrom;
21406 function boundValueFunction() {
21407 var ret = this._boundTo;
21408 if (ret !== undefined) {
21409 if (ret instanceof Promise) {
21410 if (ret.isFulfilled()) {
21411 return ret.value();
21420 function longStackTracesCaptureStackTrace() {
21421 this._trace = new CapturedTrace(this._peekContext());
21424 function longStackTracesAttachExtraTrace(error, ignoreSelf) {
21425 if (canAttachTrace(error)) {
21426 var trace = this._trace;
21427 if (trace !== undefined) {
21428 if (ignoreSelf) trace = trace._parent;
21430 if (trace !== undefined) {
21431 trace.attachExtraTrace(error);
21432 } else if (!error.__stackCleaned__) {
21433 var parsed = parseStackAndMessage(error);
21434 util.notEnumerableProp(error, "stack",
21435 parsed.message + "\n" + parsed.stack.join("\n"));
21436 util.notEnumerableProp(error, "__stackCleaned__", true);
21441 function checkForgottenReturns(returnValue, promiseCreated, name, promise,
21443 if (returnValue === undefined && promiseCreated !== null &&
21444 wForgottenReturn) {
21445 if (parent !== undefined && parent._returnedNonUndefined()) return;
21446 if ((promise._bitField & 65535) === 0) return;
21448 if (name) name = name + " ";
21449 var handlerLine = "";
21450 var creatorLine = "";
21451 if (promiseCreated._trace) {
21452 var traceLines = promiseCreated._trace.stack.split("\n");
21453 var stack = cleanStack(traceLines);
21454 for (var i = stack.length - 1; i >= 0; --i) {
21455 var line = stack[i];
21456 if (!nodeFramePattern.test(line)) {
21457 var lineMatches = line.match(parseLinePattern);
21459 handlerLine = "at " + lineMatches[1] +
21460 ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
21466 if (stack.length > 0) {
21467 var firstUserLine = stack[0];
21468 for (var i = 0; i < traceLines.length; ++i) {
21470 if (traceLines[i] === firstUserLine) {
21472 creatorLine = "\n" + traceLines[i - 1];
21480 var msg = "a promise was created in a " + name +
21481 "handler " + handlerLine + "but was not returned from it, " +
21482 "see http://goo.gl/rRqMUw" +
21484 promise._warn(msg, true, promiseCreated);
21488 function deprecated(name, replacement) {
21489 var message = name +
21490 " is deprecated and will be removed in a future version.";
21491 if (replacement) message += " Use " + replacement + " instead.";
21492 return warn(message);
21495 function warn(message, shouldUseOwnTrace, promise) {
21496 if (!config.warnings) return;
21497 var warning = new Warning(message);
21499 if (shouldUseOwnTrace) {
21500 promise._attachExtraTrace(warning);
21501 } else if (config.longStackTraces && (ctx = Promise._peekContext())) {
21502 ctx.attachExtraTrace(warning);
21504 var parsed = parseStackAndMessage(warning);
21505 warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
21508 if (!activeFireEvent("warning", warning)) {
21509 formatAndLogError(warning, "", true);
21513 function reconstructStack(message, stacks) {
21514 for (var i = 0; i < stacks.length - 1; ++i) {
21515 stacks[i].push("From previous event:");
21516 stacks[i] = stacks[i].join("\n");
21518 if (i < stacks.length) {
21519 stacks[i] = stacks[i].join("\n");
21521 return message + "\n" + stacks.join("\n");
21524 function removeDuplicateOrEmptyJumps(stacks) {
21525 for (var i = 0; i < stacks.length; ++i) {
21526 if (stacks[i].length === 0 ||
21527 ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {
21528 stacks.splice(i, 1);
21534 function removeCommonRoots(stacks) {
21535 var current = stacks[0];
21536 for (var i = 1; i < stacks.length; ++i) {
21537 var prev = stacks[i];
21538 var currentLastIndex = current.length - 1;
21539 var currentLastLine = current[currentLastIndex];
21540 var commonRootMeetPoint = -1;
21542 for (var j = prev.length - 1; j >= 0; --j) {
21543 if (prev[j] === currentLastLine) {
21544 commonRootMeetPoint = j;
21549 for (var j = commonRootMeetPoint; j >= 0; --j) {
21550 var line = prev[j];
21551 if (current[currentLastIndex] === line) {
21553 currentLastIndex--;
21562 function cleanStack(stack) {
21564 for (var i = 0; i < stack.length; ++i) {
21565 var line = stack[i];
21566 var isTraceLine = " (No stack trace)" === line ||
21567 stackFramePattern.test(line);
21568 var isInternalFrame = isTraceLine && shouldIgnore(line);
21569 if (isTraceLine && !isInternalFrame) {
21570 if (indentStackFrames && line.charAt(0) !== " ") {
21579 function stackFramesAsArray(error) {
21580 var stack = error.stack.replace(/\s+$/g, "").split("\n");
21581 for (var i = 0; i < stack.length; ++i) {
21582 var line = stack[i];
21583 if (" (No stack trace)" === line || stackFramePattern.test(line)) {
21587 if (i > 0 && error.name != "SyntaxError") {
21588 stack = stack.slice(i);
21593 function parseStackAndMessage(error) {
21594 var stack = error.stack;
21595 var message = error.toString();
21596 stack = typeof stack === "string" && stack.length > 0
21597 ? stackFramesAsArray(error) : [" (No stack trace)"];
21600 stack: error.name == "SyntaxError" ? stack : cleanStack(stack)
21604 function formatAndLogError(error, title, isSoft) {
21605 if (typeof console !== "undefined") {
21607 if (util.isObject(error)) {
21608 var stack = error.stack;
21609 message = title + formatStack(stack, error);
21611 message = title + String(error);
21613 if (typeof printWarning === "function") {
21614 printWarning(message, isSoft);
21615 } else if (typeof console.log === "function" ||
21616 typeof console.log === "object") {
21617 console.log(message);
21622 function fireRejectionEvent(name, localHandler, reason, promise) {
21623 var localEventFired = false;
21625 if (typeof localHandler === "function") {
21626 localEventFired = true;
21627 if (name === "rejectionHandled") {
21628 localHandler(promise);
21630 localHandler(reason, promise);
21634 async.throwLater(e);
21637 if (name === "unhandledRejection") {
21638 if (!activeFireEvent(name, reason, promise) && !localEventFired) {
21639 formatAndLogError(reason, "Unhandled rejection ");
21642 activeFireEvent(name, promise);
21646 function formatNonError(obj) {
21648 if (typeof obj === "function") {
21649 str = "[function " +
21650 (obj.name || "anonymous") +
21653 str = obj && typeof obj.toString === "function"
21654 ? obj.toString() : util.toString(obj);
21655 var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
21656 if (ruselessToString.test(str)) {
21658 var newStr = JSON.stringify(obj);
21665 if (str.length === 0) {
21666 str = "(empty array)";
21669 return ("(<" + snip(str) + ">, no stack trace)");
21672 function snip(str) {
21674 if (str.length < maxChars) {
21677 return str.substr(0, maxChars - 3) + "...";
21680 function longStackTracesIsSupported() {
21681 return typeof captureStackTrace === "function";
21684 var shouldIgnore = function() { return false; };
21685 var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
21686 function parseLineInfo(line) {
21687 var matches = line.match(parseLineInfoRegex);
21690 fileName: matches[1],
21691 line: parseInt(matches[2], 10)
21696 function setBounds(firstLineError, lastLineError) {
21697 if (!longStackTracesIsSupported()) return;
21698 var firstStackLines = firstLineError.stack.split("\n");
21699 var lastStackLines = lastLineError.stack.split("\n");
21700 var firstIndex = -1;
21701 var lastIndex = -1;
21704 for (var i = 0; i < firstStackLines.length; ++i) {
21705 var result = parseLineInfo(firstStackLines[i]);
21707 firstFileName = result.fileName;
21708 firstIndex = result.line;
21712 for (var i = 0; i < lastStackLines.length; ++i) {
21713 var result = parseLineInfo(lastStackLines[i]);
21715 lastFileName = result.fileName;
21716 lastIndex = result.line;
21720 if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||
21721 firstFileName !== lastFileName || firstIndex >= lastIndex) {
21725 shouldIgnore = function(line) {
21726 if (bluebirdFramePattern.test(line)) return true;
21727 var info = parseLineInfo(line);
21729 if (info.fileName === firstFileName &&
21730 (firstIndex <= info.line && info.line <= lastIndex)) {
21738 function CapturedTrace(parent) {
21739 this._parent = parent;
21740 this._promisesCreated = 0;
21741 var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
21742 captureStackTrace(this, CapturedTrace);
21743 if (length > 32) this.uncycle();
21745 util.inherits(CapturedTrace, Error);
21746 Context.CapturedTrace = CapturedTrace;
21748 CapturedTrace.prototype.uncycle = function() {
21749 var length = this._length;
21750 if (length < 2) return;
21752 var stackToIndex = {};
21754 for (var i = 0, node = this; node !== undefined; ++i) {
21756 node = node._parent;
21758 length = this._length = i;
21759 for (var i = length - 1; i >= 0; --i) {
21760 var stack = nodes[i].stack;
21761 if (stackToIndex[stack] === undefined) {
21762 stackToIndex[stack] = i;
21765 for (var i = 0; i < length; ++i) {
21766 var currentStack = nodes[i].stack;
21767 var index = stackToIndex[currentStack];
21768 if (index !== undefined && index !== i) {
21770 nodes[index - 1]._parent = undefined;
21771 nodes[index - 1]._length = 1;
21773 nodes[i]._parent = undefined;
21774 nodes[i]._length = 1;
21775 var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
21777 if (index < length - 1) {
21778 cycleEdgeNode._parent = nodes[index + 1];
21779 cycleEdgeNode._parent.uncycle();
21780 cycleEdgeNode._length =
21781 cycleEdgeNode._parent._length + 1;
21783 cycleEdgeNode._parent = undefined;
21784 cycleEdgeNode._length = 1;
21786 var currentChildLength = cycleEdgeNode._length + 1;
21787 for (var j = i - 2; j >= 0; --j) {
21788 nodes[j]._length = currentChildLength;
21789 currentChildLength++;
21796 CapturedTrace.prototype.attachExtraTrace = function(error) {
21797 if (error.__stackCleaned__) return;
21799 var parsed = parseStackAndMessage(error);
21800 var message = parsed.message;
21801 var stacks = [parsed.stack];
21804 while (trace !== undefined) {
21805 stacks.push(cleanStack(trace.stack.split("\n")));
21806 trace = trace._parent;
21808 removeCommonRoots(stacks);
21809 removeDuplicateOrEmptyJumps(stacks);
21810 util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
21811 util.notEnumerableProp(error, "__stackCleaned__", true);
21814 var captureStackTrace = (function stackDetection() {
21815 var v8stackFramePattern = /^\s*at\s*/;
21816 var v8stackFormatter = function(stack, error) {
21817 if (typeof stack === "string") return stack;
21819 if (error.name !== undefined &&
21820 error.message !== undefined) {
21821 return error.toString();
21823 return formatNonError(error);
21826 if (typeof Error.stackTraceLimit === "number" &&
21827 typeof Error.captureStackTrace === "function") {
21828 Error.stackTraceLimit += 6;
21829 stackFramePattern = v8stackFramePattern;
21830 formatStack = v8stackFormatter;
21831 var captureStackTrace = Error.captureStackTrace;
21833 shouldIgnore = function(line) {
21834 return bluebirdFramePattern.test(line);
21836 return function(receiver, ignoreUntil) {
21837 Error.stackTraceLimit += 6;
21838 captureStackTrace(receiver, ignoreUntil);
21839 Error.stackTraceLimit -= 6;
21842 var err = new Error();
21844 if (typeof err.stack === "string" &&
21845 err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
21846 stackFramePattern = /@/;
21847 formatStack = v8stackFormatter;
21848 indentStackFrames = true;
21849 return function captureStackTrace(o) {
21850 o.stack = new Error().stack;
21854 var hasStackAfterThrow;
21855 try { throw new Error(); }
21857 hasStackAfterThrow = ("stack" in e);
21859 if (!("stack" in err) && hasStackAfterThrow &&
21860 typeof Error.stackTraceLimit === "number") {
21861 stackFramePattern = v8stackFramePattern;
21862 formatStack = v8stackFormatter;
21863 return function captureStackTrace(o) {
21864 Error.stackTraceLimit += 6;
21865 try { throw new Error(); }
21866 catch(e) { o.stack = e.stack; }
21867 Error.stackTraceLimit -= 6;
21871 formatStack = function(stack, error) {
21872 if (typeof stack === "string") return stack;
21874 if ((typeof error === "object" ||
21875 typeof error === "function") &&
21876 error.name !== undefined &&
21877 error.message !== undefined) {
21878 return error.toString();
21880 return formatNonError(error);
21887 if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
21888 printWarning = function (message) {
21889 console.warn(message);
21891 if (util.isNode && process.stderr.isTTY) {
21892 printWarning = function(message, isSoft) {
21893 var color = isSoft ? "\u001b[33m" : "\u001b[31m";
21894 console.warn(color + message + "\u001b[0m\n");
21896 } else if (!util.isNode && typeof (new Error().stack) === "string") {
21897 printWarning = function(message, isSoft) {
21898 console.warn("%c" + message,
21899 isSoft ? "color: darkorange" : "color: red");
21905 warnings: warnings,
21906 longStackTraces: false,
21907 cancellation: false,
21911 if (longStackTraces) Promise.longStackTraces();
21914 longStackTraces: function() {
21915 return config.longStackTraces;
21917 warnings: function() {
21918 return config.warnings;
21920 cancellation: function() {
21921 return config.cancellation;
21923 monitoring: function() {
21924 return config.monitoring;
21926 propagateFromFunction: function() {
21927 return propagateFromFunction;
21929 boundValueFunction: function() {
21930 return boundValueFunction;
21932 checkForgottenReturns: checkForgottenReturns,
21933 setBounds: setBounds,
21935 deprecated: deprecated,
21936 CapturedTrace: CapturedTrace,
21937 fireDomEvent: fireDomEvent,
21938 fireGlobalEvent: fireGlobalEvent
21945 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
21949 module.exports = function(Promise, tryConvertToPromise) {
21950 var util = __webpack_require__(130);
21951 var CancellationError = Promise.CancellationError;
21952 var errorObj = util.errorObj;
21954 function PassThroughHandlerContext(promise, type, handler) {
21955 this.promise = promise;
21957 this.handler = handler;
21958 this.called = false;
21959 this.cancelPromise = null;
21962 PassThroughHandlerContext.prototype.isFinallyHandler = function() {
21963 return this.type === 0;
21966 function FinallyHandlerCancelReaction(finallyHandler) {
21967 this.finallyHandler = finallyHandler;
21970 FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
21971 checkCancel(this.finallyHandler);
21974 function checkCancel(ctx, reason) {
21975 if (ctx.cancelPromise != null) {
21976 if (arguments.length > 1) {
21977 ctx.cancelPromise._reject(reason);
21979 ctx.cancelPromise._cancel();
21981 ctx.cancelPromise = null;
21987 function succeed() {
21988 return finallyHandler.call(this, this.promise._target()._settledValue());
21990 function fail(reason) {
21991 if (checkCancel(this, reason)) return;
21992 errorObj.e = reason;
21995 function finallyHandler(reasonOrValue) {
21996 var promise = this.promise;
21997 var handler = this.handler;
21999 if (!this.called) {
22000 this.called = true;
22001 var ret = this.isFinallyHandler()
22002 ? handler.call(promise._boundValue())
22003 : handler.call(promise._boundValue(), reasonOrValue);
22004 if (ret !== undefined) {
22005 promise._setReturnedNonUndefined();
22006 var maybePromise = tryConvertToPromise(ret, promise);
22007 if (maybePromise instanceof Promise) {
22008 if (this.cancelPromise != null) {
22009 if (maybePromise._isCancelled()) {
22011 new CancellationError("late cancellation observer");
22012 promise._attachExtraTrace(reason);
22013 errorObj.e = reason;
22015 } else if (maybePromise.isPending()) {
22016 maybePromise._attachCancellationCallback(
22017 new FinallyHandlerCancelReaction(this));
22020 return maybePromise._then(
22021 succeed, fail, undefined, this, undefined);
22026 if (promise.isRejected()) {
22028 errorObj.e = reasonOrValue;
22032 return reasonOrValue;
22036 Promise.prototype._passThrough = function(handler, type, success, fail) {
22037 if (typeof handler !== "function") return this.then();
22038 return this._then(success,
22041 new PassThroughHandlerContext(this, type, handler),
22045 Promise.prototype.lastly =
22046 Promise.prototype["finally"] = function (handler) {
22047 return this._passThrough(handler,
22053 Promise.prototype.tap = function (handler) {
22054 return this._passThrough(handler, 1, finallyHandler);
22057 return PassThroughHandlerContext;
22063 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22067 module.exports = function(NEXT_FILTER) {
22068 var util = __webpack_require__(130);
22069 var getKeys = __webpack_require__(131).keys;
22070 var tryCatch = util.tryCatch;
22071 var errorObj = util.errorObj;
22073 function catchFilter(instances, cb, promise) {
22074 return function(e) {
22075 var boundTo = promise._boundValue();
22076 predicateLoop: for (var i = 0; i < instances.length; ++i) {
22077 var item = instances[i];
22079 if (item === Error ||
22080 (item != null && item.prototype instanceof Error)) {
22081 if (e instanceof item) {
22082 return tryCatch(cb).call(boundTo, e);
22084 } else if (typeof item === "function") {
22085 var matchesPredicate = tryCatch(item).call(boundTo, e);
22086 if (matchesPredicate === errorObj) {
22087 return matchesPredicate;
22088 } else if (matchesPredicate) {
22089 return tryCatch(cb).call(boundTo, e);
22091 } else if (util.isObject(e)) {
22092 var keys = getKeys(item);
22093 for (var j = 0; j < keys.length; ++j) {
22095 if (item[key] != e[key]) {
22096 continue predicateLoop;
22099 return tryCatch(cb).call(boundTo, e);
22102 return NEXT_FILTER;
22106 return catchFilter;
22112 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22116 var util = __webpack_require__(130);
22117 var maybeWrapAsError = util.maybeWrapAsError;
22118 var errors = __webpack_require__(135);
22119 var OperationalError = errors.OperationalError;
22120 var es5 = __webpack_require__(131);
22122 function isUntypedError(obj) {
22123 return obj instanceof Error &&
22124 es5.getPrototypeOf(obj) === Error.prototype;
22127 var rErrorKey = /^(?:name|message|stack|cause)$/;
22128 function wrapAsOperationalError(obj) {
22130 if (isUntypedError(obj)) {
22131 ret = new OperationalError(obj);
22132 ret.name = obj.name;
22133 ret.message = obj.message;
22134 ret.stack = obj.stack;
22135 var keys = es5.keys(obj);
22136 for (var i = 0; i < keys.length; ++i) {
22138 if (!rErrorKey.test(key)) {
22139 ret[key] = obj[key];
22144 util.markAsOriginatingFromRejection(obj);
22148 function nodebackForPromise(promise, multiArgs) {
22149 return function(err, value) {
22150 if (promise === null) return;
22152 var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
22153 promise._attachExtraTrace(wrapped);
22154 promise._reject(wrapped);
22155 } else if (!multiArgs) {
22156 promise._fulfill(value);
22158 var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};
22159 promise._fulfill(args);
22165 module.exports = nodebackForPromise;
22170 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22175 function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
22176 var util = __webpack_require__(130);
22177 var tryCatch = util.tryCatch;
22179 Promise.method = function (fn) {
22180 if (typeof fn !== "function") {
22181 throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
22183 return function () {
22184 var ret = new Promise(INTERNAL);
22185 ret._captureStackTrace();
22186 ret._pushContext();
22187 var value = tryCatch(fn).apply(this, arguments);
22188 var promiseCreated = ret._popContext();
22189 debug.checkForgottenReturns(
22190 value, promiseCreated, "Promise.method", ret);
22191 ret._resolveFromSyncValue(value);
22196 Promise.attempt = Promise["try"] = function (fn) {
22197 if (typeof fn !== "function") {
22198 return apiRejection("expecting a function but got " + util.classString(fn));
22200 var ret = new Promise(INTERNAL);
22201 ret._captureStackTrace();
22202 ret._pushContext();
22204 if (arguments.length > 1) {
22205 debug.deprecated("calling Promise.try with more than 1 argument");
22206 var arg = arguments[1];
22207 var ctx = arguments[2];
22208 value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
22209 : tryCatch(fn).call(ctx, arg);
22211 value = tryCatch(fn)();
22213 var promiseCreated = ret._popContext();
22214 debug.checkForgottenReturns(
22215 value, promiseCreated, "Promise.try", ret);
22216 ret._resolveFromSyncValue(value);
22220 Promise.prototype._resolveFromSyncValue = function (value) {
22221 if (value === util.errorObj) {
22222 this._rejectCallback(value.e, false);
22224 this._resolveCallback(value, true);
22232 /***/ ((module) => {
22236 module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
22237 var calledBind = false;
22238 var rejectThis = function(_, e) {
22242 var targetRejected = function(e, context) {
22243 context.promiseRejectionQueued = true;
22244 context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
22247 var bindingResolved = function(thisArg, context) {
22248 if (((this._bitField & 50397184) === 0)) {
22249 this._resolveCallback(context.target);
22253 var bindingRejected = function(e, context) {
22254 if (!context.promiseRejectionQueued) this._reject(e);
22257 Promise.prototype.bind = function (thisArg) {
22260 Promise.prototype._propagateFrom = debug.propagateFromFunction();
22261 Promise.prototype._boundValue = debug.boundValueFunction();
22263 var maybePromise = tryConvertToPromise(thisArg);
22264 var ret = new Promise(INTERNAL);
22265 ret._propagateFrom(this, 1);
22266 var target = this._target();
22267 ret._setBoundTo(maybePromise);
22268 if (maybePromise instanceof Promise) {
22270 promiseRejectionQueued: false,
22273 bindingPromise: maybePromise
22275 target._then(INTERNAL, targetRejected, undefined, ret, context);
22276 maybePromise._then(
22277 bindingResolved, bindingRejected, undefined, ret, context);
22278 ret._setOnCancel(maybePromise);
22280 ret._resolveCallback(target);
22285 Promise.prototype._setBoundTo = function (obj) {
22286 if (obj !== undefined) {
22287 this._bitField = this._bitField | 2097152;
22288 this._boundTo = obj;
22290 this._bitField = this._bitField & (~2097152);
22294 Promise.prototype._isBound = function () {
22295 return (this._bitField & 2097152) === 2097152;
22298 Promise.bind = function (thisArg, value) {
22299 return Promise.resolve(value).bind(thisArg);
22306 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22310 module.exports = function(Promise, PromiseArray, apiRejection, debug) {
22311 var util = __webpack_require__(130);
22312 var tryCatch = util.tryCatch;
22313 var errorObj = util.errorObj;
22314 var async = Promise._async;
22316 Promise.prototype["break"] = Promise.prototype.cancel = function() {
22317 if (!debug.cancellation()) return this._warn("cancellation is disabled");
22319 var promise = this;
22320 var child = promise;
22321 while (promise._isCancellable()) {
22322 if (!promise._cancelBy(child)) {
22323 if (child._isFollowing()) {
22324 child._followee().cancel();
22326 child._cancelBranched();
22331 var parent = promise._cancellationParent;
22332 if (parent == null || !parent._isCancellable()) {
22333 if (promise._isFollowing()) {
22334 promise._followee().cancel();
22336 promise._cancelBranched();
22340 if (promise._isFollowing()) promise._followee().cancel();
22341 promise._setWillBeCancelled();
22348 Promise.prototype._branchHasCancelled = function() {
22349 this._branchesRemainingToCancel--;
22352 Promise.prototype._enoughBranchesHaveCancelled = function() {
22353 return this._branchesRemainingToCancel === undefined ||
22354 this._branchesRemainingToCancel <= 0;
22357 Promise.prototype._cancelBy = function(canceller) {
22358 if (canceller === this) {
22359 this._branchesRemainingToCancel = 0;
22360 this._invokeOnCancel();
22363 this._branchHasCancelled();
22364 if (this._enoughBranchesHaveCancelled()) {
22365 this._invokeOnCancel();
22372 Promise.prototype._cancelBranched = function() {
22373 if (this._enoughBranchesHaveCancelled()) {
22378 Promise.prototype._cancel = function() {
22379 if (!this._isCancellable()) return;
22380 this._setCancelled();
22381 async.invoke(this._cancelPromises, this, undefined);
22384 Promise.prototype._cancelPromises = function() {
22385 if (this._length() > 0) this._settlePromises();
22388 Promise.prototype._unsetOnCancel = function() {
22389 this._onCancelField = undefined;
22392 Promise.prototype._isCancellable = function() {
22393 return this.isPending() && !this._isCancelled();
22396 Promise.prototype.isCancellable = function() {
22397 return this.isPending() && !this.isCancelled();
22400 Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
22401 if (util.isArray(onCancelCallback)) {
22402 for (var i = 0; i < onCancelCallback.length; ++i) {
22403 this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
22405 } else if (onCancelCallback !== undefined) {
22406 if (typeof onCancelCallback === "function") {
22407 if (!internalOnly) {
22408 var e = tryCatch(onCancelCallback).call(this._boundValue());
22409 if (e === errorObj) {
22410 this._attachExtraTrace(e.e);
22411 async.throwLater(e.e);
22415 onCancelCallback._resultCancelled(this);
22420 Promise.prototype._invokeOnCancel = function() {
22421 var onCancelCallback = this._onCancel();
22422 this._unsetOnCancel();
22423 async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
22426 Promise.prototype._invokeInternalOnCancel = function() {
22427 if (this._isCancellable()) {
22428 this._doInvokeOnCancel(this._onCancel(), true);
22429 this._unsetOnCancel();
22433 Promise.prototype._resultCancelled = function() {
22442 /***/ ((module) => {
22446 module.exports = function(Promise) {
22447 function returner() {
22450 function thrower() {
22454 Promise.prototype["return"] =
22455 Promise.prototype.thenReturn = function (value) {
22456 if (value instanceof Promise) value.suppressUnhandledRejections();
22458 returner, undefined, undefined, {value: value}, undefined);
22461 Promise.prototype["throw"] =
22462 Promise.prototype.thenThrow = function (reason) {
22464 thrower, undefined, undefined, {reason: reason}, undefined);
22467 Promise.prototype.catchThrow = function (reason) {
22468 if (arguments.length <= 1) {
22470 undefined, thrower, undefined, {reason: reason}, undefined);
22472 var _reason = arguments[1];
22473 var handler = function() {throw _reason;};
22474 return this.caught(reason, handler);
22478 Promise.prototype.catchReturn = function (value) {
22479 if (arguments.length <= 1) {
22480 if (value instanceof Promise) value.suppressUnhandledRejections();
22482 undefined, returner, undefined, {value: value}, undefined);
22484 var _value = arguments[1];
22485 if (_value instanceof Promise) _value.suppressUnhandledRejections();
22486 var handler = function() {return _value;};
22487 return this.caught(value, handler);
22495 /***/ ((module) => {
22499 module.exports = function(Promise) {
22500 function PromiseInspection(promise) {
22501 if (promise !== undefined) {
22502 promise = promise._target();
22503 this._bitField = promise._bitField;
22504 this._settledValueField = promise._isFateSealed()
22505 ? promise._settledValue() : undefined;
22508 this._bitField = 0;
22509 this._settledValueField = undefined;
22513 PromiseInspection.prototype._settledValue = function() {
22514 return this._settledValueField;
22517 var value = PromiseInspection.prototype.value = function () {
22518 if (!this.isFulfilled()) {
22519 throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
22521 return this._settledValue();
22524 var reason = PromiseInspection.prototype.error =
22525 PromiseInspection.prototype.reason = function () {
22526 if (!this.isRejected()) {
22527 throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
22529 return this._settledValue();
22532 var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
22533 return (this._bitField & 33554432) !== 0;
22536 var isRejected = PromiseInspection.prototype.isRejected = function () {
22537 return (this._bitField & 16777216) !== 0;
22540 var isPending = PromiseInspection.prototype.isPending = function () {
22541 return (this._bitField & 50397184) === 0;
22544 var isResolved = PromiseInspection.prototype.isResolved = function () {
22545 return (this._bitField & 50331648) !== 0;
22548 PromiseInspection.prototype.isCancelled = function() {
22549 return (this._bitField & 8454144) !== 0;
22552 Promise.prototype.__isCancelled = function() {
22553 return (this._bitField & 65536) === 65536;
22556 Promise.prototype._isCancelled = function() {
22557 return this._target().__isCancelled();
22560 Promise.prototype.isCancelled = function() {
22561 return (this._target()._bitField & 8454144) !== 0;
22564 Promise.prototype.isPending = function() {
22565 return isPending.call(this._target());
22568 Promise.prototype.isRejected = function() {
22569 return isRejected.call(this._target());
22572 Promise.prototype.isFulfilled = function() {
22573 return isFulfilled.call(this._target());
22576 Promise.prototype.isResolved = function() {
22577 return isResolved.call(this._target());
22580 Promise.prototype.value = function() {
22581 return value.call(this._target());
22584 Promise.prototype.reason = function() {
22585 var target = this._target();
22586 target._unsetRejectionIsUnhandled();
22587 return reason.call(target);
22590 Promise.prototype._value = function() {
22591 return this._settledValue();
22594 Promise.prototype._reason = function() {
22595 this._unsetRejectionIsUnhandled();
22596 return this._settledValue();
22599 Promise.PromiseInspection = PromiseInspection;
22605 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22610 function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,
22612 var util = __webpack_require__(130);
22613 var canEvaluate = util.canEvaluate;
22614 var tryCatch = util.tryCatch;
22615 var errorObj = util.errorObj;
22620 var thenCallback = function(i) {
22621 return new Function("value", "holder", " \n\
22623 holder.pIndex = value; \n\
22624 holder.checkFulfillment(this); \n\
22625 ".replace(/Index/g, i));
22628 var promiseSetter = function(i) {
22629 return new Function("promise", "holder", " \n\
22631 holder.pIndex = promise; \n\
22632 ".replace(/Index/g, i));
22635 var generateHolderClass = function(total) {
22636 var props = new Array(total);
22637 for (var i = 0; i < props.length; ++i) {
22638 props[i] = "this.p" + (i+1);
22640 var assignment = props.join(" = ") + " = null;";
22641 var cancellationCode= "var promise;\n" + props.map(function(prop) {
22643 promise = " + prop + "; \n\
22644 if (promise instanceof Promise) { \n\
22645 promise.cancel(); \n\
22649 var passedArguments = props.join(", ");
22650 var name = "Holder$" + total;
22653 var code = "return function(tryCatch, errorObj, Promise, async) { \n\
22655 function [TheName](fn) { \n\
22656 [TheProperties] \n\
22658 this.asyncNeeded = true; \n\
22662 [TheName].prototype._callFunction = function(promise) { \n\
22663 promise._pushContext(); \n\
22664 var ret = tryCatch(this.fn)([ThePassedArguments]); \n\
22665 promise._popContext(); \n\
22666 if (ret === errorObj) { \n\
22667 promise._rejectCallback(ret.e, false); \n\
22669 promise._resolveCallback(ret); \n\
22673 [TheName].prototype.checkFulfillment = function(promise) { \n\
22674 var now = ++this.now; \n\
22675 if (now === [TheTotal]) { \n\
22676 if (this.asyncNeeded) { \n\
22677 async.invoke(this._callFunction, this, promise); \n\
22679 this._callFunction(promise); \n\
22685 [TheName].prototype._resultCancelled = function() { \n\
22686 [CancellationCode] \n\
22689 return [TheName]; \n\
22690 }(tryCatch, errorObj, Promise, async); \n\
22693 code = code.replace(/\[TheName\]/g, name)
22694 .replace(/\[TheTotal\]/g, total)
22695 .replace(/\[ThePassedArguments\]/g, passedArguments)
22696 .replace(/\[TheProperties\]/g, assignment)
22697 .replace(/\[CancellationCode\]/g, cancellationCode);
22699 return new Function("tryCatch", "errorObj", "Promise", "async", code)
22700 (tryCatch, errorObj, Promise, async);
22703 var holderClasses = [];
22704 var thenCallbacks = [];
22705 var promiseSetters = [];
22707 for (var i = 0; i < 8; ++i) {
22708 holderClasses.push(generateHolderClass(i + 1));
22709 thenCallbacks.push(thenCallback(i + 1));
22710 promiseSetters.push(promiseSetter(i + 1));
22713 reject = function (reason) {
22714 this._reject(reason);
22718 Promise.join = function () {
22719 var last = arguments.length - 1;
22721 if (last > 0 && typeof arguments[last] === "function") {
22722 fn = arguments[last];
22724 if (last <= 8 && canEvaluate) {
22725 var ret = new Promise(INTERNAL);
22726 ret._captureStackTrace();
22727 var HolderClass = holderClasses[last - 1];
22728 var holder = new HolderClass(fn);
22729 var callbacks = thenCallbacks;
22731 for (var i = 0; i < last; ++i) {
22732 var maybePromise = tryConvertToPromise(arguments[i], ret);
22733 if (maybePromise instanceof Promise) {
22734 maybePromise = maybePromise._target();
22735 var bitField = maybePromise._bitField;
22737 if (((bitField & 50397184) === 0)) {
22738 maybePromise._then(callbacks[i], reject,
22739 undefined, ret, holder);
22740 promiseSetters[i](maybePromise, holder);
22741 holder.asyncNeeded = false;
22742 } else if (((bitField & 33554432) !== 0)) {
22743 callbacks[i].call(ret,
22744 maybePromise._value(), holder);
22745 } else if (((bitField & 16777216) !== 0)) {
22746 ret._reject(maybePromise._reason());
22751 callbacks[i].call(ret, maybePromise, holder);
22755 if (!ret._isFateSealed()) {
22756 if (holder.asyncNeeded) {
22757 var domain = getDomain();
22758 if (domain !== null) {
22759 holder.fn = util.domainBind(domain, holder.fn);
22762 ret._setAsyncGuaranteed();
22763 ret._setOnCancel(holder);
22769 var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];};
22770 if (fn) args.pop();
22771 var ret = new PromiseArray(args).promise();
22772 return fn !== undefined ? ret.spread(fn) : ret;
22780 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22784 module.exports = function(Promise,
22787 tryConvertToPromise,
22790 var getDomain = Promise._getDomain;
22791 var util = __webpack_require__(130);
22792 var tryCatch = util.tryCatch;
22793 var errorObj = util.errorObj;
22794 var async = Promise._async;
22796 function MappingPromiseArray(promises, fn, limit, _filter) {
22797 this.constructor$(promises);
22798 this._promise._captureStackTrace();
22799 var domain = getDomain();
22800 this._callback = domain === null ? fn : util.domainBind(domain, fn);
22801 this._preservedValues = _filter === INTERNAL
22802 ? new Array(this.length())
22804 this._limit = limit;
22805 this._inFlight = 0;
22807 async.invoke(this._asyncInit, this, undefined);
22809 util.inherits(MappingPromiseArray, PromiseArray);
22811 MappingPromiseArray.prototype._asyncInit = function() {
22812 this._init$(undefined, -2);
22815 MappingPromiseArray.prototype._init = function () {};
22817 MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
22818 var values = this._values;
22819 var length = this.length();
22820 var preservedValues = this._preservedValues;
22821 var limit = this._limit;
22824 index = (index * -1) - 1;
22825 values[index] = value;
22828 this._drainQueue();
22829 if (this._isResolved()) return true;
22832 if (limit >= 1 && this._inFlight >= limit) {
22833 values[index] = value;
22834 this._queue.push(index);
22837 if (preservedValues !== null) preservedValues[index] = value;
22839 var promise = this._promise;
22840 var callback = this._callback;
22841 var receiver = promise._boundValue();
22842 promise._pushContext();
22843 var ret = tryCatch(callback).call(receiver, value, index, length);
22844 var promiseCreated = promise._popContext();
22845 debug.checkForgottenReturns(
22848 preservedValues !== null ? "Promise.filter" : "Promise.map",
22851 if (ret === errorObj) {
22852 this._reject(ret.e);
22856 var maybePromise = tryConvertToPromise(ret, this._promise);
22857 if (maybePromise instanceof Promise) {
22858 maybePromise = maybePromise._target();
22859 var bitField = maybePromise._bitField;
22861 if (((bitField & 50397184) === 0)) {
22862 if (limit >= 1) this._inFlight++;
22863 values[index] = maybePromise;
22864 maybePromise._proxy(this, (index + 1) * -1);
22866 } else if (((bitField & 33554432) !== 0)) {
22867 ret = maybePromise._value();
22868 } else if (((bitField & 16777216) !== 0)) {
22869 this._reject(maybePromise._reason());
22876 values[index] = ret;
22878 var totalResolved = ++this._totalResolved;
22879 if (totalResolved >= length) {
22880 if (preservedValues !== null) {
22881 this._filter(values, preservedValues);
22883 this._resolve(values);
22890 MappingPromiseArray.prototype._drainQueue = function () {
22891 var queue = this._queue;
22892 var limit = this._limit;
22893 var values = this._values;
22894 while (queue.length > 0 && this._inFlight < limit) {
22895 if (this._isResolved()) return;
22896 var index = queue.pop();
22897 this._promiseFulfilled(values[index], index);
22901 MappingPromiseArray.prototype._filter = function (booleans, values) {
22902 var len = values.length;
22903 var ret = new Array(len);
22905 for (var i = 0; i < len; ++i) {
22906 if (booleans[i]) ret[j++] = values[i];
22909 this._resolve(ret);
22912 MappingPromiseArray.prototype.preservedValues = function () {
22913 return this._preservedValues;
22916 function map(promises, fn, options, _filter) {
22917 if (typeof fn !== "function") {
22918 return apiRejection("expecting a function but got " + util.classString(fn));
22922 if (options !== undefined) {
22923 if (typeof options === "object" && options !== null) {
22924 if (typeof options.concurrency !== "number") {
22925 return Promise.reject(
22926 new TypeError("'concurrency' must be a number but it is " +
22927 util.classString(options.concurrency)));
22929 limit = options.concurrency;
22931 return Promise.reject(new TypeError(
22932 "options argument must be an object but it is " +
22933 util.classString(options)));
22936 limit = typeof limit === "number" &&
22937 isFinite(limit) && limit >= 1 ? limit : 0;
22938 return new MappingPromiseArray(promises, fn, limit, _filter).promise();
22941 Promise.prototype.map = function (fn, options) {
22942 return map(this, fn, options, null);
22945 Promise.map = function (promises, fn, options, _filter) {
22946 return map(promises, fn, options, _filter);
22955 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22959 var cr = Object.create;
22961 var callerCache = cr(null);
22962 var getterCache = cr(null);
22963 callerCache[" size"] = getterCache[" size"] = 0;
22966 module.exports = function(Promise) {
22967 var util = __webpack_require__(130);
22968 var canEvaluate = util.canEvaluate;
22969 var isIdentifier = util.isIdentifier;
22971 var getMethodCaller;
22974 var makeMethodCaller = function (methodName) {
22975 return new Function("ensureMethod", " \n\
22976 return function(obj) { \n\
22978 var len = this.length; \n\
22979 ensureMethod(obj, 'methodName'); \n\
22981 case 1: return obj.methodName(this[0]); \n\
22982 case 2: return obj.methodName(this[0], this[1]); \n\
22983 case 3: return obj.methodName(this[0], this[1], this[2]); \n\
22984 case 0: return obj.methodName(); \n\
22986 return obj.methodName.apply(obj, this); \n\
22989 ".replace(/methodName/g, methodName))(ensureMethod);
22992 var makeGetter = function (propertyName) {
22993 return new Function("obj", " \n\
22995 return obj.propertyName; \n\
22996 ".replace("propertyName", propertyName));
22999 var getCompiled = function(name, compiler, cache) {
23000 var ret = cache[name];
23001 if (typeof ret !== "function") {
23002 if (!isIdentifier(name)) {
23005 ret = compiler(name);
23008 if (cache[" size"] > 512) {
23009 var keys = Object.keys(cache);
23010 for (var i = 0; i < 256; ++i) delete cache[keys[i]];
23011 cache[" size"] = keys.length - 256;
23017 getMethodCaller = function(name) {
23018 return getCompiled(name, makeMethodCaller, callerCache);
23021 getGetter = function(name) {
23022 return getCompiled(name, makeGetter, getterCache);
23026 function ensureMethod(obj, methodName) {
23028 if (obj != null) fn = obj[methodName];
23029 if (typeof fn !== "function") {
23030 var message = "Object " + util.classString(obj) + " has no method '" +
23031 util.toString(methodName) + "'";
23032 throw new Promise.TypeError(message);
23037 function caller(obj) {
23038 var methodName = this.pop();
23039 var fn = ensureMethod(obj, methodName);
23040 return fn.apply(obj, this);
23042 Promise.prototype.call = function (methodName) {
23043 var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};
23046 var maybeCaller = getMethodCaller(methodName);
23047 if (maybeCaller !== null) {
23049 maybeCaller, undefined, undefined, args, undefined);
23053 args.push(methodName);
23054 return this._then(caller, undefined, undefined, args, undefined);
23057 function namedGetter(obj) {
23060 function indexedGetter(obj) {
23062 if (index < 0) index = Math.max(0, index + obj.length);
23065 Promise.prototype.get = function (propertyName) {
23066 var isIndex = (typeof propertyName === "number");
23070 var maybeGetter = getGetter(propertyName);
23071 getter = maybeGetter !== null ? maybeGetter : namedGetter;
23073 getter = namedGetter;
23076 getter = indexedGetter;
23078 return this._then(getter, undefined, undefined, propertyName, undefined);
23085 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23089 module.exports = function (Promise, apiRejection, tryConvertToPromise,
23090 createContext, INTERNAL, debug) {
23091 var util = __webpack_require__(130);
23092 var TypeError = __webpack_require__(135).TypeError;
23093 var inherits = __webpack_require__(130).inherits;
23094 var errorObj = util.errorObj;
23095 var tryCatch = util.tryCatch;
23098 function thrower(e) {
23099 setTimeout(function(){throw e;}, 0);
23102 function castPreservingDisposable(thenable) {
23103 var maybePromise = tryConvertToPromise(thenable);
23104 if (maybePromise !== thenable &&
23105 typeof thenable._isDisposable === "function" &&
23106 typeof thenable._getDisposer === "function" &&
23107 thenable._isDisposable()) {
23108 maybePromise._setDisposable(thenable._getDisposer());
23110 return maybePromise;
23112 function dispose(resources, inspection) {
23114 var len = resources.length;
23115 var ret = new Promise(INTERNAL);
23116 function iterator() {
23117 if (i >= len) return ret._fulfill();
23118 var maybePromise = castPreservingDisposable(resources[i++]);
23119 if (maybePromise instanceof Promise &&
23120 maybePromise._isDisposable()) {
23122 maybePromise = tryConvertToPromise(
23123 maybePromise._getDisposer().tryDispose(inspection),
23124 resources.promise);
23128 if (maybePromise instanceof Promise) {
23129 return maybePromise._then(iterator, thrower,
23139 function Disposer(data, promise, context) {
23141 this._promise = promise;
23142 this._context = context;
23145 Disposer.prototype.data = function () {
23149 Disposer.prototype.promise = function () {
23150 return this._promise;
23153 Disposer.prototype.resource = function () {
23154 if (this.promise().isFulfilled()) {
23155 return this.promise().value();
23160 Disposer.prototype.tryDispose = function(inspection) {
23161 var resource = this.resource();
23162 var context = this._context;
23163 if (context !== undefined) context._pushContext();
23164 var ret = resource !== NULL
23165 ? this.doDispose(resource, inspection) : null;
23166 if (context !== undefined) context._popContext();
23167 this._promise._unsetDisposable();
23172 Disposer.isDisposer = function (d) {
23173 return (d != null &&
23174 typeof d.resource === "function" &&
23175 typeof d.tryDispose === "function");
23178 function FunctionDisposer(fn, promise, context) {
23179 this.constructor$(fn, promise, context);
23181 inherits(FunctionDisposer, Disposer);
23183 FunctionDisposer.prototype.doDispose = function (resource, inspection) {
23184 var fn = this.data();
23185 return fn.call(resource, resource, inspection);
23188 function maybeUnwrapDisposer(value) {
23189 if (Disposer.isDisposer(value)) {
23190 this.resources[this.index]._setDisposable(value);
23191 return value.promise();
23196 function ResourceList(length) {
23197 this.length = length;
23198 this.promise = null;
23199 this[length-1] = null;
23202 ResourceList.prototype._resultCancelled = function() {
23203 var len = this.length;
23204 for (var i = 0; i < len; ++i) {
23205 var item = this[i];
23206 if (item instanceof Promise) {
23212 Promise.using = function () {
23213 var len = arguments.length;
23214 if (len < 2) return apiRejection(
23215 "you must pass at least 2 arguments to Promise.using");
23216 var fn = arguments[len - 1];
23217 if (typeof fn !== "function") {
23218 return apiRejection("expecting a function but got " + util.classString(fn));
23221 var spreadArgs = true;
23222 if (len === 2 && Array.isArray(arguments[0])) {
23223 input = arguments[0];
23224 len = input.length;
23225 spreadArgs = false;
23230 var resources = new ResourceList(len);
23231 for (var i = 0; i < len; ++i) {
23232 var resource = input[i];
23233 if (Disposer.isDisposer(resource)) {
23234 var disposer = resource;
23235 resource = resource.promise();
23236 resource._setDisposable(disposer);
23238 var maybePromise = tryConvertToPromise(resource);
23239 if (maybePromise instanceof Promise) {
23241 maybePromise._then(maybeUnwrapDisposer, null, null, {
23242 resources: resources,
23247 resources[i] = resource;
23250 var reflectedResources = new Array(resources.length);
23251 for (var i = 0; i < reflectedResources.length; ++i) {
23252 reflectedResources[i] = Promise.resolve(resources[i]).reflect();
23255 var resultPromise = Promise.all(reflectedResources)
23256 .then(function(inspections) {
23257 for (var i = 0; i < inspections.length; ++i) {
23258 var inspection = inspections[i];
23259 if (inspection.isRejected()) {
23260 errorObj.e = inspection.error();
23262 } else if (!inspection.isFulfilled()) {
23263 resultPromise.cancel();
23266 inspections[i] = inspection.value();
23268 promise._pushContext();
23271 var ret = spreadArgs
23272 ? fn.apply(undefined, inspections) : fn(inspections);
23273 var promiseCreated = promise._popContext();
23274 debug.checkForgottenReturns(
23275 ret, promiseCreated, "Promise.using", promise);
23279 var promise = resultPromise.lastly(function() {
23280 var inspection = new Promise.PromiseInspection(resultPromise);
23281 return dispose(resources, inspection);
23283 resources.promise = promise;
23284 promise._setOnCancel(resources);
23288 Promise.prototype._setDisposable = function (disposer) {
23289 this._bitField = this._bitField | 131072;
23290 this._disposer = disposer;
23293 Promise.prototype._isDisposable = function () {
23294 return (this._bitField & 131072) > 0;
23297 Promise.prototype._getDisposer = function () {
23298 return this._disposer;
23301 Promise.prototype._unsetDisposable = function () {
23302 this._bitField = this._bitField & (~131072);
23303 this._disposer = undefined;
23306 Promise.prototype.disposer = function (fn) {
23307 if (typeof fn === "function") {
23308 return new FunctionDisposer(fn, this, createContext());
23310 throw new TypeError();
23318 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23322 module.exports = function(Promise, INTERNAL, debug) {
23323 var util = __webpack_require__(130);
23324 var TimeoutError = Promise.TimeoutError;
23326 function HandleWrapper(handle) {
23327 this.handle = handle;
23330 HandleWrapper.prototype._resultCancelled = function() {
23331 clearTimeout(this.handle);
23334 var afterValue = function(value) { return delay(+this).thenReturn(value); };
23335 var delay = Promise.delay = function (ms, value) {
23338 if (value !== undefined) {
23339 ret = Promise.resolve(value)
23340 ._then(afterValue, null, null, ms, undefined);
23341 if (debug.cancellation() && value instanceof Promise) {
23342 ret._setOnCancel(value);
23345 ret = new Promise(INTERNAL);
23346 handle = setTimeout(function() { ret._fulfill(); }, +ms);
23347 if (debug.cancellation()) {
23348 ret._setOnCancel(new HandleWrapper(handle));
23350 ret._captureStackTrace();
23352 ret._setAsyncGuaranteed();
23356 Promise.prototype.delay = function (ms) {
23357 return delay(ms, this);
23360 var afterTimeout = function (promise, message, parent) {
23362 if (typeof message !== "string") {
23363 if (message instanceof Error) {
23366 err = new TimeoutError("operation timed out");
23369 err = new TimeoutError(message);
23371 util.markAsOriginatingFromRejection(err);
23372 promise._attachExtraTrace(err);
23373 promise._reject(err);
23375 if (parent != null) {
23380 function successClear(value) {
23381 clearTimeout(this.handle);
23385 function failureClear(reason) {
23386 clearTimeout(this.handle);
23390 Promise.prototype.timeout = function (ms, message) {
23394 var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
23395 if (ret.isPending()) {
23396 afterTimeout(ret, message, parent);
23400 if (debug.cancellation()) {
23401 parent = this.then();
23402 ret = parent._then(successClear, failureClear,
23403 undefined, handleWrapper, undefined);
23404 ret._setOnCancel(handleWrapper);
23406 ret = this._then(successClear, failureClear,
23407 undefined, handleWrapper, undefined);
23418 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23422 module.exports = function(Promise,
23425 tryConvertToPromise,
23428 var errors = __webpack_require__(135);
23429 var TypeError = errors.TypeError;
23430 var util = __webpack_require__(130);
23431 var errorObj = util.errorObj;
23432 var tryCatch = util.tryCatch;
23433 var yieldHandlers = [];
23435 function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
23436 for (var i = 0; i < yieldHandlers.length; ++i) {
23437 traceParent._pushContext();
23438 var result = tryCatch(yieldHandlers[i])(value);
23439 traceParent._popContext();
23440 if (result === errorObj) {
23441 traceParent._pushContext();
23442 var ret = Promise.reject(errorObj.e);
23443 traceParent._popContext();
23446 var maybePromise = tryConvertToPromise(result, traceParent);
23447 if (maybePromise instanceof Promise) return maybePromise;
23452 function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
23453 if (debug.cancellation()) {
23454 var internal = new Promise(INTERNAL);
23455 var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);
23456 this._promise = internal.lastly(function() {
23457 return _finallyPromise;
23459 internal._captureStackTrace();
23460 internal._setOnCancel(this);
23462 var promise = this._promise = new Promise(INTERNAL);
23463 promise._captureStackTrace();
23465 this._stack = stack;
23466 this._generatorFunction = generatorFunction;
23467 this._receiver = receiver;
23468 this._generator = undefined;
23469 this._yieldHandlers = typeof yieldHandler === "function"
23470 ? [yieldHandler].concat(yieldHandlers)
23472 this._yieldedPromise = null;
23473 this._cancellationPhase = false;
23475 util.inherits(PromiseSpawn, Proxyable);
23477 PromiseSpawn.prototype._isResolved = function() {
23478 return this._promise === null;
23481 PromiseSpawn.prototype._cleanup = function() {
23482 this._promise = this._generator = null;
23483 if (debug.cancellation() && this._finallyPromise !== null) {
23484 this._finallyPromise._fulfill();
23485 this._finallyPromise = null;
23489 PromiseSpawn.prototype._promiseCancelled = function() {
23490 if (this._isResolved()) return;
23491 var implementsReturn = typeof this._generator["return"] !== "undefined";
23494 if (!implementsReturn) {
23495 var reason = new Promise.CancellationError(
23496 "generator .return() sentinel");
23497 Promise.coroutine.returnSentinel = reason;
23498 this._promise._attachExtraTrace(reason);
23499 this._promise._pushContext();
23500 result = tryCatch(this._generator["throw"]).call(this._generator,
23502 this._promise._popContext();
23504 this._promise._pushContext();
23505 result = tryCatch(this._generator["return"]).call(this._generator,
23507 this._promise._popContext();
23509 this._cancellationPhase = true;
23510 this._yieldedPromise = null;
23511 this._continue(result);
23514 PromiseSpawn.prototype._promiseFulfilled = function(value) {
23515 this._yieldedPromise = null;
23516 this._promise._pushContext();
23517 var result = tryCatch(this._generator.next).call(this._generator, value);
23518 this._promise._popContext();
23519 this._continue(result);
23522 PromiseSpawn.prototype._promiseRejected = function(reason) {
23523 this._yieldedPromise = null;
23524 this._promise._attachExtraTrace(reason);
23525 this._promise._pushContext();
23526 var result = tryCatch(this._generator["throw"])
23527 .call(this._generator, reason);
23528 this._promise._popContext();
23529 this._continue(result);
23532 PromiseSpawn.prototype._resultCancelled = function() {
23533 if (this._yieldedPromise instanceof Promise) {
23534 var promise = this._yieldedPromise;
23535 this._yieldedPromise = null;
23540 PromiseSpawn.prototype.promise = function () {
23541 return this._promise;
23544 PromiseSpawn.prototype._run = function () {
23545 this._generator = this._generatorFunction.call(this._receiver);
23547 this._generatorFunction = undefined;
23548 this._promiseFulfilled(undefined);
23551 PromiseSpawn.prototype._continue = function (result) {
23552 var promise = this._promise;
23553 if (result === errorObj) {
23555 if (this._cancellationPhase) {
23556 return promise.cancel();
23558 return promise._rejectCallback(result.e, false);
23562 var value = result.value;
23563 if (result.done === true) {
23565 if (this._cancellationPhase) {
23566 return promise.cancel();
23568 return promise._resolveCallback(value);
23571 var maybePromise = tryConvertToPromise(value, this._promise);
23572 if (!(maybePromise instanceof Promise)) {
23574 promiseFromYieldHandler(maybePromise,
23575 this._yieldHandlers,
23577 if (maybePromise === null) {
23578 this._promiseRejected(
23580 "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", value) +
23581 "From coroutine:\u000a" +
23582 this._stack.split("\n").slice(1, -7).join("\n")
23588 maybePromise = maybePromise._target();
23589 var bitField = maybePromise._bitField;
23591 if (((bitField & 50397184) === 0)) {
23592 this._yieldedPromise = maybePromise;
23593 maybePromise._proxy(this, null);
23594 } else if (((bitField & 33554432) !== 0)) {
23595 Promise._async.invoke(
23596 this._promiseFulfilled, this, maybePromise._value()
23598 } else if (((bitField & 16777216) !== 0)) {
23599 Promise._async.invoke(
23600 this._promiseRejected, this, maybePromise._reason()
23603 this._promiseCancelled();
23608 Promise.coroutine = function (generatorFunction, options) {
23609 if (typeof generatorFunction !== "function") {
23610 throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
23612 var yieldHandler = Object(options).yieldHandler;
23613 var PromiseSpawn$ = PromiseSpawn;
23614 var stack = new Error().stack;
23615 return function () {
23616 var generator = generatorFunction.apply(this, arguments);
23617 var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
23619 var ret = spawn.promise();
23620 spawn._generator = generator;
23621 spawn._promiseFulfilled(undefined);
23626 Promise.coroutine.addYieldHandler = function(fn) {
23627 if (typeof fn !== "function") {
23628 throw new TypeError("expecting a function but got " + util.classString(fn));
23630 yieldHandlers.push(fn);
23633 Promise.spawn = function (generatorFunction) {
23634 debug.deprecated("Promise.spawn()", "Promise.coroutine()");
23635 if (typeof generatorFunction !== "function") {
23636 return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
23638 var spawn = new PromiseSpawn(generatorFunction, this);
23639 var ret = spawn.promise();
23640 spawn._run(Promise.spawn);
23648 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23652 module.exports = function(Promise) {
23653 var util = __webpack_require__(130);
23654 var async = Promise._async;
23655 var tryCatch = util.tryCatch;
23656 var errorObj = util.errorObj;
23658 function spreadAdapter(val, nodeback) {
23659 var promise = this;
23660 if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
23662 tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));
23663 if (ret === errorObj) {
23664 async.throwLater(ret.e);
23668 function successAdapter(val, nodeback) {
23669 var promise = this;
23670 var receiver = promise._boundValue();
23671 var ret = val === undefined
23672 ? tryCatch(nodeback).call(receiver, null)
23673 : tryCatch(nodeback).call(receiver, null, val);
23674 if (ret === errorObj) {
23675 async.throwLater(ret.e);
23678 function errorAdapter(reason, nodeback) {
23679 var promise = this;
23681 var newReason = new Error(reason + "");
23682 newReason.cause = reason;
23683 reason = newReason;
23685 var ret = tryCatch(nodeback).call(promise._boundValue(), reason);
23686 if (ret === errorObj) {
23687 async.throwLater(ret.e);
23691 Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,
23693 if (typeof nodeback == "function") {
23694 var adapter = successAdapter;
23695 if (options !== undefined && Object(options).spread) {
23696 adapter = spreadAdapter;
23713 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23717 module.exports = function(Promise, INTERNAL) {
23719 var util = __webpack_require__(130);
23720 var nodebackForPromise = __webpack_require__(142);
23721 var withAppended = util.withAppended;
23722 var maybeWrapAsError = util.maybeWrapAsError;
23723 var canEvaluate = util.canEvaluate;
23724 var TypeError = __webpack_require__(135).TypeError;
23725 var defaultSuffix = "Async";
23726 var defaultPromisified = {__isPromisified__: true};
23727 var noCopyProps = [
23734 "__isPromisified__"
23736 var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
23738 var defaultFilter = function(name) {
23739 return util.isIdentifier(name) &&
23740 name.charAt(0) !== "_" &&
23741 name !== "constructor";
23744 function propsFilter(key) {
23745 return !noCopyPropsPattern.test(key);
23748 function isPromisified(fn) {
23750 return fn.__isPromisified__ === true;
23757 function hasPromisified(obj, key, suffix) {
23758 var val = util.getDataPropertyOrDefault(obj, key + suffix,
23759 defaultPromisified);
23760 return val ? isPromisified(val) : false;
23762 function checkValid(ret, suffix, suffixRegexp) {
23763 for (var i = 0; i < ret.length; i += 2) {
23765 if (suffixRegexp.test(key)) {
23766 var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
23767 for (var j = 0; j < ret.length; j += 2) {
23768 if (ret[j] === keyWithoutAsyncSuffix) {
23769 throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a"
23770 .replace("%s", suffix));
23777 function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
23778 var keys = util.inheritedDataKeys(obj);
23780 for (var i = 0; i < keys.length; ++i) {
23782 var value = obj[key];
23783 var passesDefaultFilter = filter === defaultFilter
23784 ? true : defaultFilter(key, value, obj);
23785 if (typeof value === "function" &&
23786 !isPromisified(value) &&
23787 !hasPromisified(obj, key, suffix) &&
23788 filter(key, value, obj, passesDefaultFilter)) {
23789 ret.push(key, value);
23792 checkValid(ret, suffix, suffixRegexp);
23796 var escapeIdentRegex = function(str) {
23797 return str.replace(/([$])/, "\\$");
23800 var makeNodePromisifiedEval;
23802 var switchCaseArgumentOrder = function(likelyArgumentCount) {
23803 var ret = [likelyArgumentCount];
23804 var min = Math.max(0, likelyArgumentCount - 1 - 3);
23805 for(var i = likelyArgumentCount - 1; i >= min; --i) {
23808 for(var i = likelyArgumentCount + 1; i <= 3; ++i) {
23814 var argumentSequence = function(argumentCount) {
23815 return util.filledRange(argumentCount, "_arg", "");
23818 var parameterDeclaration = function(parameterCount) {
23819 return util.filledRange(
23820 Math.max(parameterCount, 3), "_arg", "");
23823 var parameterCount = function(fn) {
23824 if (typeof fn.length === "number") {
23825 return Math.max(Math.min(fn.length, 1023 + 1), 0);
23830 makeNodePromisifiedEval =
23831 function(callback, receiver, originalName, fn, _, multiArgs) {
23832 var newParameterCount = Math.max(0, parameterCount(fn) - 1);
23833 var argumentOrder = switchCaseArgumentOrder(newParameterCount);
23834 var shouldProxyThis = typeof callback === "string" || receiver === THIS;
23836 function generateCallForArgumentCount(count) {
23837 var args = argumentSequence(count).join(", ");
23838 var comma = count > 0 ? ", " : "";
23840 if (shouldProxyThis) {
23841 ret = "ret = callback.call(this, {{args}}, nodeback); break;\n";
23843 ret = receiver === undefined
23844 ? "ret = callback({{args}}, nodeback); break;\n"
23845 : "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
23847 return ret.replace("{{args}}", args).replace(", ", comma);
23850 function generateArgumentSwitchCase() {
23852 for (var i = 0; i < argumentOrder.length; ++i) {
23853 ret += "case " + argumentOrder[i] +":" +
23854 generateCallForArgumentCount(argumentOrder[i]);
23859 var args = new Array(len + 1); \n\
23861 for (var i = 0; i < len; ++i) { \n\
23862 args[i] = arguments[i]; \n\
23864 args[i] = nodeback; \n\
23867 ".replace("[CodeForCall]", (shouldProxyThis
23868 ? "ret = callback.apply(this, args);\n"
23869 : "ret = callback.apply(receiver, args);\n"));
23873 var getFunctionCode = typeof callback === "string"
23874 ? ("this != null ? this['"+callback+"'] : fn")
23876 var body = "'use strict'; \n\
23877 var ret = function (Parameters) { \n\
23879 var len = arguments.length; \n\
23880 var promise = new Promise(INTERNAL); \n\
23881 promise._captureStackTrace(); \n\
23882 var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\
23884 var callback = tryCatch([GetFunctionCode]); \n\
23886 [CodeForSwitchCase] \n\
23888 if (ret === errorObj) { \n\
23889 promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\
23891 if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\
23892 return promise; \n\
23894 notEnumerableProp(ret, '__isPromisified__', true); \n\
23896 ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase())
23897 .replace("[GetFunctionCode]", getFunctionCode);
23898 body = body.replace("Parameters", parameterDeclaration(newParameterCount));
23899 return new Function("Promise",
23903 "maybeWrapAsError",
23904 "nodebackForPromise",
23907 "notEnumerableProp",
23915 nodebackForPromise,
23918 util.notEnumerableProp,
23923 function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
23924 var defaultThis = (function() {return this;})();
23925 var method = callback;
23926 if (typeof method === "string") {
23929 function promisified() {
23930 var _receiver = receiver;
23931 if (receiver === THIS) _receiver = this;
23932 var promise = new Promise(INTERNAL);
23933 promise._captureStackTrace();
23934 var cb = typeof method === "string" && this !== defaultThis
23935 ? this[method] : callback;
23936 var fn = nodebackForPromise(promise, multiArgs);
23938 cb.apply(_receiver, withAppended(arguments, fn));
23940 promise._rejectCallback(maybeWrapAsError(e), true, true);
23942 if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
23945 util.notEnumerableProp(promisified, "__isPromisified__", true);
23946 return promisified;
23949 var makeNodePromisified = canEvaluate
23950 ? makeNodePromisifiedEval
23951 : makeNodePromisifiedClosure;
23953 function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
23954 var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
23956 promisifiableMethods(obj, suffix, suffixRegexp, filter);
23958 for (var i = 0, len = methods.length; i < len; i+= 2) {
23959 var key = methods[i];
23960 var fn = methods[i+1];
23961 var promisifiedKey = key + suffix;
23962 if (promisifier === makeNodePromisified) {
23963 obj[promisifiedKey] =
23964 makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
23966 var promisified = promisifier(fn, function() {
23967 return makeNodePromisified(key, THIS, key,
23968 fn, suffix, multiArgs);
23970 util.notEnumerableProp(promisified, "__isPromisified__", true);
23971 obj[promisifiedKey] = promisified;
23974 util.toFastProperties(obj);
23978 function promisify(callback, receiver, multiArgs) {
23979 return makeNodePromisified(callback, receiver, undefined,
23980 callback, null, multiArgs);
23983 Promise.promisify = function (fn, options) {
23984 if (typeof fn !== "function") {
23985 throw new TypeError("expecting a function but got " + util.classString(fn));
23987 if (isPromisified(fn)) {
23990 options = Object(options);
23991 var receiver = options.context === undefined ? THIS : options.context;
23992 var multiArgs = !!options.multiArgs;
23993 var ret = promisify(fn, receiver, multiArgs);
23994 util.copyDescriptors(fn, ret, propsFilter);
23998 Promise.promisifyAll = function (target, options) {
23999 if (typeof target !== "function" && typeof target !== "object") {
24000 throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
24002 options = Object(options);
24003 var multiArgs = !!options.multiArgs;
24004 var suffix = options.suffix;
24005 if (typeof suffix !== "string") suffix = defaultSuffix;
24006 var filter = options.filter;
24007 if (typeof filter !== "function") filter = defaultFilter;
24008 var promisifier = options.promisifier;
24009 if (typeof promisifier !== "function") promisifier = makeNodePromisified;
24011 if (!util.isIdentifier(suffix)) {
24012 throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a");
24015 var keys = util.inheritedDataKeys(target);
24016 for (var i = 0; i < keys.length; ++i) {
24017 var value = target[keys[i]];
24018 if (keys[i] !== "constructor" &&
24019 util.isClass(value)) {
24020 promisifyAll(value.prototype, suffix, filter, promisifier,
24022 promisifyAll(value, suffix, filter, promisifier, multiArgs);
24026 return promisifyAll(target, suffix, filter, promisifier, multiArgs);
24034 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24038 module.exports = function(
24039 Promise, PromiseArray, tryConvertToPromise, apiRejection) {
24040 var util = __webpack_require__(130);
24041 var isObject = util.isObject;
24042 var es5 = __webpack_require__(131);
24044 if (typeof Map === "function") Es6Map = Map;
24046 var mapToEntries = (function() {
24050 function extractEntry(value, key) {
24051 this[index] = value;
24052 this[index + size] = key;
24056 return function mapToEntries(map) {
24059 var ret = new Array(map.size * 2);
24060 map.forEach(extractEntry, ret);
24065 var entriesToMap = function(entries) {
24066 var ret = new Es6Map();
24067 var length = entries.length / 2 | 0;
24068 for (var i = 0; i < length; ++i) {
24069 var key = entries[length + i];
24070 var value = entries[i];
24071 ret.set(key, value);
24076 function PropertiesPromiseArray(obj) {
24079 if (Es6Map !== undefined && obj instanceof Es6Map) {
24080 entries = mapToEntries(obj);
24083 var keys = es5.keys(obj);
24084 var len = keys.length;
24085 entries = new Array(len * 2);
24086 for (var i = 0; i < len; ++i) {
24088 entries[i] = obj[key];
24089 entries[i + len] = key;
24092 this.constructor$(entries);
24093 this._isMap = isMap;
24094 this._init$(undefined, -3);
24096 util.inherits(PropertiesPromiseArray, PromiseArray);
24098 PropertiesPromiseArray.prototype._init = function () {};
24100 PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
24101 this._values[index] = value;
24102 var totalResolved = ++this._totalResolved;
24103 if (totalResolved >= this._length) {
24106 val = entriesToMap(this._values);
24109 var keyOffset = this.length();
24110 for (var i = 0, len = this.length(); i < len; ++i) {
24111 val[this._values[i + keyOffset]] = this._values[i];
24114 this._resolve(val);
24120 PropertiesPromiseArray.prototype.shouldCopyValues = function () {
24124 PropertiesPromiseArray.prototype.getActualLength = function (len) {
24128 function props(promises) {
24130 var castValue = tryConvertToPromise(promises);
24132 if (!isObject(castValue)) {
24133 return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a");
24134 } else if (castValue instanceof Promise) {
24135 ret = castValue._then(
24136 Promise.props, undefined, undefined, undefined, undefined);
24138 ret = new PropertiesPromiseArray(castValue).promise();
24141 if (castValue instanceof Promise) {
24142 ret._propagateFrom(castValue, 2);
24147 Promise.prototype.props = function () {
24148 return props(this);
24151 Promise.props = function (promises) {
24152 return props(promises);
24159 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24163 module.exports = function(
24164 Promise, INTERNAL, tryConvertToPromise, apiRejection) {
24165 var util = __webpack_require__(130);
24167 var raceLater = function (promise) {
24168 return promise.then(function(array) {
24169 return race(array, promise);
24173 function race(promises, parent) {
24174 var maybePromise = tryConvertToPromise(promises);
24176 if (maybePromise instanceof Promise) {
24177 return raceLater(maybePromise);
24179 promises = util.asArray(promises);
24180 if (promises === null)
24181 return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
24184 var ret = new Promise(INTERNAL);
24185 if (parent !== undefined) {
24186 ret._propagateFrom(parent, 3);
24188 var fulfill = ret._fulfill;
24189 var reject = ret._reject;
24190 for (var i = 0, len = promises.length; i < len; ++i) {
24191 var val = promises[i];
24193 if (val === undefined && !(i in promises)) {
24197 Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
24202 Promise.race = function (promises) {
24203 return race(promises, undefined);
24206 Promise.prototype.race = function () {
24207 return race(this, undefined);
24215 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24219 module.exports = function(Promise,
24222 tryConvertToPromise,
24225 var getDomain = Promise._getDomain;
24226 var util = __webpack_require__(130);
24227 var tryCatch = util.tryCatch;
24229 function ReductionPromiseArray(promises, fn, initialValue, _each) {
24230 this.constructor$(promises);
24231 var domain = getDomain();
24232 this._fn = domain === null ? fn : util.domainBind(domain, fn);
24233 if (initialValue !== undefined) {
24234 initialValue = Promise.resolve(initialValue);
24235 initialValue._attachCancellationCallback(this);
24237 this._initialValue = initialValue;
24238 this._currentCancellable = null;
24239 if(_each === INTERNAL) {
24240 this._eachValues = Array(this._length);
24241 } else if (_each === 0) {
24242 this._eachValues = null;
24244 this._eachValues = undefined;
24246 this._promise._captureStackTrace();
24247 this._init$(undefined, -5);
24249 util.inherits(ReductionPromiseArray, PromiseArray);
24251 ReductionPromiseArray.prototype._gotAccum = function(accum) {
24252 if (this._eachValues !== undefined &&
24253 this._eachValues !== null &&
24254 accum !== INTERNAL) {
24255 this._eachValues.push(accum);
24259 ReductionPromiseArray.prototype._eachComplete = function(value) {
24260 if (this._eachValues !== null) {
24261 this._eachValues.push(value);
24263 return this._eachValues;
24266 ReductionPromiseArray.prototype._init = function() {};
24268 ReductionPromiseArray.prototype._resolveEmptyArray = function() {
24269 this._resolve(this._eachValues !== undefined ? this._eachValues
24270 : this._initialValue);
24273 ReductionPromiseArray.prototype.shouldCopyValues = function () {
24277 ReductionPromiseArray.prototype._resolve = function(value) {
24278 this._promise._resolveCallback(value);
24279 this._values = null;
24282 ReductionPromiseArray.prototype._resultCancelled = function(sender) {
24283 if (sender === this._initialValue) return this._cancel();
24284 if (this._isResolved()) return;
24285 this._resultCancelled$();
24286 if (this._currentCancellable instanceof Promise) {
24287 this._currentCancellable.cancel();
24289 if (this._initialValue instanceof Promise) {
24290 this._initialValue.cancel();
24294 ReductionPromiseArray.prototype._iterate = function (values) {
24295 this._values = values;
24298 var length = values.length;
24299 if (this._initialValue !== undefined) {
24300 value = this._initialValue;
24303 value = Promise.resolve(values[0]);
24307 this._currentCancellable = value;
24309 if (!value.isRejected()) {
24310 for (; i < length; ++i) {
24318 value = value._then(gotAccum, undefined, undefined, ctx, undefined);
24322 if (this._eachValues !== undefined) {
24324 ._then(this._eachComplete, undefined, undefined, this, undefined);
24326 value._then(completed, completed, undefined, value, this);
24329 Promise.prototype.reduce = function (fn, initialValue) {
24330 return reduce(this, fn, initialValue, null);
24333 Promise.reduce = function (promises, fn, initialValue, _each) {
24334 return reduce(promises, fn, initialValue, _each);
24337 function completed(valueOrReason, array) {
24338 if (this.isFulfilled()) {
24339 array._resolve(valueOrReason);
24341 array._reject(valueOrReason);
24345 function reduce(promises, fn, initialValue, _each) {
24346 if (typeof fn !== "function") {
24347 return apiRejection("expecting a function but got " + util.classString(fn));
24349 var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
24350 return array.promise();
24353 function gotAccum(accum) {
24354 this.accum = accum;
24355 this.array._gotAccum(accum);
24356 var value = tryConvertToPromise(this.value, this.array._promise);
24357 if (value instanceof Promise) {
24358 this.array._currentCancellable = value;
24359 return value._then(gotValue, undefined, undefined, this, undefined);
24361 return gotValue.call(this, value);
24365 function gotValue(value) {
24366 var array = this.array;
24367 var promise = array._promise;
24368 var fn = tryCatch(array._fn);
24369 promise._pushContext();
24371 if (array._eachValues !== undefined) {
24372 ret = fn.call(promise._boundValue(), value, this.index, this.length);
24374 ret = fn.call(promise._boundValue(),
24375 this.accum, value, this.index, this.length);
24377 if (ret instanceof Promise) {
24378 array._currentCancellable = ret;
24380 var promiseCreated = promise._popContext();
24381 debug.checkForgottenReturns(
24384 array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
24394 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24399 function(Promise, PromiseArray, debug) {
24400 var PromiseInspection = Promise.PromiseInspection;
24401 var util = __webpack_require__(130);
24403 function SettledPromiseArray(values) {
24404 this.constructor$(values);
24406 util.inherits(SettledPromiseArray, PromiseArray);
24408 SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {
24409 this._values[index] = inspection;
24410 var totalResolved = ++this._totalResolved;
24411 if (totalResolved >= this._length) {
24412 this._resolve(this._values);
24418 SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
24419 var ret = new PromiseInspection();
24420 ret._bitField = 33554432;
24421 ret._settledValueField = value;
24422 return this._promiseResolved(index, ret);
24424 SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
24425 var ret = new PromiseInspection();
24426 ret._bitField = 16777216;
24427 ret._settledValueField = reason;
24428 return this._promiseResolved(index, ret);
24431 Promise.settle = function (promises) {
24432 debug.deprecated(".settle()", ".reflect()");
24433 return new SettledPromiseArray(promises).promise();
24436 Promise.prototype.settle = function () {
24437 return Promise.settle(this);
24444 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24449 function(Promise, PromiseArray, apiRejection) {
24450 var util = __webpack_require__(130);
24451 var RangeError = __webpack_require__(135).RangeError;
24452 var AggregateError = __webpack_require__(135).AggregateError;
24453 var isArray = util.isArray;
24454 var CANCELLATION = {};
24457 function SomePromiseArray(values) {
24458 this.constructor$(values);
24460 this._unwrap = false;
24461 this._initialized = false;
24463 util.inherits(SomePromiseArray, PromiseArray);
24465 SomePromiseArray.prototype._init = function () {
24466 if (!this._initialized) {
24469 if (this._howMany === 0) {
24473 this._init$(undefined, -5);
24474 var isArrayResolved = isArray(this._values);
24475 if (!this._isResolved() &&
24477 this._howMany > this._canPossiblyFulfill()) {
24478 this._reject(this._getRangeError(this.length()));
24482 SomePromiseArray.prototype.init = function () {
24483 this._initialized = true;
24487 SomePromiseArray.prototype.setUnwrap = function () {
24488 this._unwrap = true;
24491 SomePromiseArray.prototype.howMany = function () {
24492 return this._howMany;
24495 SomePromiseArray.prototype.setHowMany = function (count) {
24496 this._howMany = count;
24499 SomePromiseArray.prototype._promiseFulfilled = function (value) {
24500 this._addFulfilled(value);
24501 if (this._fulfilled() === this.howMany()) {
24502 this._values.length = this.howMany();
24503 if (this.howMany() === 1 && this._unwrap) {
24504 this._resolve(this._values[0]);
24506 this._resolve(this._values);
24513 SomePromiseArray.prototype._promiseRejected = function (reason) {
24514 this._addRejected(reason);
24515 return this._checkOutcome();
24518 SomePromiseArray.prototype._promiseCancelled = function () {
24519 if (this._values instanceof Promise || this._values == null) {
24520 return this._cancel();
24522 this._addRejected(CANCELLATION);
24523 return this._checkOutcome();
24526 SomePromiseArray.prototype._checkOutcome = function() {
24527 if (this.howMany() > this._canPossiblyFulfill()) {
24528 var e = new AggregateError();
24529 for (var i = this.length(); i < this._values.length; ++i) {
24530 if (this._values[i] !== CANCELLATION) {
24531 e.push(this._values[i]);
24534 if (e.length > 0) {
24544 SomePromiseArray.prototype._fulfilled = function () {
24545 return this._totalResolved;
24548 SomePromiseArray.prototype._rejected = function () {
24549 return this._values.length - this.length();
24552 SomePromiseArray.prototype._addRejected = function (reason) {
24553 this._values.push(reason);
24556 SomePromiseArray.prototype._addFulfilled = function (value) {
24557 this._values[this._totalResolved++] = value;
24560 SomePromiseArray.prototype._canPossiblyFulfill = function () {
24561 return this.length() - this._rejected();
24564 SomePromiseArray.prototype._getRangeError = function (count) {
24565 var message = "Input array must contain at least " +
24566 this._howMany + " items but contains only " + count + " items";
24567 return new RangeError(message);
24570 SomePromiseArray.prototype._resolveEmptyArray = function () {
24571 this._reject(this._getRangeError(0));
24574 function some(promises, howMany) {
24575 if ((howMany | 0) !== howMany || howMany < 0) {
24576 return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a");
24578 var ret = new SomePromiseArray(promises);
24579 var promise = ret.promise();
24580 ret.setHowMany(howMany);
24585 Promise.some = function (promises, howMany) {
24586 return some(promises, howMany);
24589 Promise.prototype.some = function (howMany) {
24590 return some(this, howMany);
24593 Promise._SomePromiseArray = SomePromiseArray;
24599 /***/ ((module) => {
24603 module.exports = function(Promise, INTERNAL) {
24604 var PromiseMap = Promise.map;
24606 Promise.prototype.filter = function (fn, options) {
24607 return PromiseMap(this, fn, options, INTERNAL);
24610 Promise.filter = function (promises, fn, options) {
24611 return PromiseMap(promises, fn, options, INTERNAL);
24618 /***/ ((module) => {
24622 module.exports = function(Promise, INTERNAL) {
24623 var PromiseReduce = Promise.reduce;
24624 var PromiseAll = Promise.all;
24626 function promiseAllThis() {
24627 return PromiseAll(this);
24630 function PromiseMapSeries(promises, fn) {
24631 return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
24634 Promise.prototype.each = function (fn) {
24635 return PromiseReduce(this, fn, INTERNAL, 0)
24636 ._then(promiseAllThis, undefined, undefined, this, undefined);
24639 Promise.prototype.mapSeries = function (fn) {
24640 return PromiseReduce(this, fn, INTERNAL, INTERNAL);
24643 Promise.each = function (promises, fn) {
24644 return PromiseReduce(promises, fn, INTERNAL, 0)
24645 ._then(promiseAllThis, undefined, undefined, promises, undefined);
24648 Promise.mapSeries = PromiseMapSeries;
24655 /***/ ((module) => {
24659 module.exports = function(Promise) {
24660 var SomePromiseArray = Promise._SomePromiseArray;
24661 function any(promises) {
24662 var ret = new SomePromiseArray(promises);
24663 var promise = ret.promise();
24670 Promise.any = function (promises) {
24671 return any(promises);
24674 Promise.prototype.any = function () {
24683 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24685 var Stream = __webpack_require__(44);
24686 var Promise = __webpack_require__(128);
24687 var util = __webpack_require__(50);
24688 var Buffer = __webpack_require__(165);
24689 var strFunction = 'function';
24691 // Backwards compatibility for node versions < 8
24692 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
24693 Stream = __webpack_require__(167);
24695 function PullStream() {
24696 if (!(this instanceof PullStream))
24697 return new PullStream();
24699 Stream.Duplex.call(this,{decodeStrings:false, objectMode:true});
24700 this.buffer = Buffer.from('');
24702 self.on('finish',function() {
24703 self.finished = true;
24704 self.emit('chunk',false);
24708 util.inherits(PullStream,Stream.Duplex);
24710 PullStream.prototype._write = function(chunk,e,cb) {
24711 this.buffer = Buffer.concat([this.buffer,chunk]);
24713 this.emit('chunk');
24717 // The `eof` parameter is interpreted as `file_length` if the type is number
24718 // otherwise (i.e. buffer) it is interpreted as a pattern signaling end of stream
24719 PullStream.prototype.stream = function(eof,includeEof) {
24720 var p = Stream.PassThrough();
24721 var done,self= this;
24724 if (typeof self.cb === strFunction) {
24725 var callback = self.cb;
24726 self.cb = undefined;
24733 if (self.buffer && self.buffer.length) {
24734 if (typeof eof === 'number') {
24735 packet = self.buffer.slice(0,eof);
24736 self.buffer = self.buffer.slice(eof);
24737 eof -= packet.length;
24740 var match = self.buffer.indexOf(eof);
24741 if (match !== -1) {
24742 // store signature match byte offset to allow us to reference
24743 // this for zip64 offset
24745 if (includeEof) match = match + eof.length;
24746 packet = self.buffer.slice(0,match);
24747 self.buffer = self.buffer.slice(match);
24750 var len = self.buffer.length - eof.length;
24754 packet = self.buffer.slice(0,len);
24755 self.buffer = self.buffer.slice(len);
24759 if (packet) p.write(packet,function() {
24760 if (self.buffer.length === 0 || (eof.length && self.buffer.length <= eof.length)) cb();
24765 if (self.finished && !this.__ended) {
24766 self.removeListener('chunk',pull);
24767 self.emit('error', new Error('FILE_ENDED'));
24768 this.__ended = true;
24773 self.removeListener('chunk',pull);
24778 self.on('chunk',pull);
24783 PullStream.prototype.pull = function(eof,includeEof) {
24784 if (eof === 0) return Promise.resolve('');
24786 // If we already have the required data in buffer
24787 // we can resolve the request immediately
24788 if (!isNaN(eof) && this.buffer.length > eof) {
24789 var data = this.buffer.slice(0,eof);
24790 this.buffer = this.buffer.slice(eof);
24791 return Promise.resolve(data);
24794 // Otherwise we stream until we have it
24795 var buffer = Buffer.from(''),
24798 var concatStream = Stream.Transform();
24799 concatStream._transform = function(d,e,cb) {
24800 buffer = Buffer.concat([buffer,d]);
24805 var pullStreamRejectHandler;
24806 return new Promise(function(resolve,reject) {
24807 rejectHandler = reject;
24808 pullStreamRejectHandler = function(e) {
24809 self.__emittedError = e;
24813 return reject(new Error('FILE_ENDED'));
24814 self.once('error',pullStreamRejectHandler); // reject any errors from pullstream itself
24815 self.stream(eof,includeEof)
24816 .on('error',reject)
24817 .pipe(concatStream)
24818 .on('finish',function() {resolve(buffer);})
24819 .on('error',reject);
24821 .finally(function() {
24822 self.removeListener('error',rejectHandler);
24823 self.removeListener('error',pullStreamRejectHandler);
24827 PullStream.prototype._read = function(){};
24829 module.exports = PullStream;
24834 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24836 var Buffer = __webpack_require__(166).Buffer;
24838 // Backwards compatibility for node versions < 8
24839 if (Buffer.from === undefined) {
24840 Buffer.from = function (a, b, c) {
24841 return new Buffer(a, b, c)
24844 Buffer.alloc = Buffer.from;
24847 module.exports = Buffer;
24851 /***/ ((module) => {
24854 module.exports = require("buffer");;
24858 /***/ ((module, exports, __webpack_require__) => {
24860 var Stream = __webpack_require__(44);
24861 if (process.env.READABLE_STREAM === 'disable' && Stream) {
24862 module.exports = Stream;
24863 exports = module.exports = Stream.Readable;
24864 exports.Readable = Stream.Readable;
24865 exports.Writable = Stream.Writable;
24866 exports.Duplex = Stream.Duplex;
24867 exports.Transform = Stream.Transform;
24868 exports.PassThrough = Stream.PassThrough;
24869 exports.Stream = Stream;
24871 exports = module.exports = __webpack_require__(168);
24872 exports.Stream = Stream || exports;
24873 exports.Readable = exports;
24874 exports.Writable = __webpack_require__(177);
24875 exports.Duplex = __webpack_require__(176);
24876 exports.Transform = __webpack_require__(180);
24877 exports.PassThrough = __webpack_require__(181);
24883 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24886 // Copyright Joyent, Inc. and other Node contributors.
24888 // Permission is hereby granted, free of charge, to any person obtaining a
24889 // copy of this software and associated documentation files (the
24890 // "Software"), to deal in the Software without restriction, including
24891 // without limitation the rights to use, copy, modify, merge, publish,
24892 // distribute, sublicense, and/or sell copies of the Software, and to permit
24893 // persons to whom the Software is furnished to do so, subject to the
24894 // following conditions:
24896 // The above copyright notice and this permission notice shall be included
24897 // in all copies or substantial portions of the Software.
24899 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24900 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24901 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
24902 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
24903 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24904 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24905 // USE OR OTHER DEALINGS IN THE SOFTWARE.
24911 var pna = __webpack_require__(169);
24914 module.exports = Readable;
24917 var isArray = __webpack_require__(170);
24924 Readable.ReadableState = ReadableState;
24927 var EE = __webpack_require__(68).EventEmitter;
24929 var EElistenerCount = function (emitter, type) {
24930 return emitter.listeners(type).length;
24935 var Stream = __webpack_require__(171);
24940 var Buffer = __webpack_require__(172).Buffer;
24941 var OurUint8Array = global.Uint8Array || function () {};
24942 function _uint8ArrayToBuffer(chunk) {
24943 return Buffer.from(chunk);
24945 function _isUint8Array(obj) {
24946 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
24952 var util = Object.create(__webpack_require__(173));
24953 util.inherits = __webpack_require__(66);
24957 var debugUtil = __webpack_require__(50);
24958 var debug = void 0;
24959 if (debugUtil && debugUtil.debuglog) {
24960 debug = debugUtil.debuglog('stream');
24962 debug = function () {};
24966 var BufferList = __webpack_require__(174);
24967 var destroyImpl = __webpack_require__(175);
24970 util.inherits(Readable, Stream);
24972 var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
24974 function prependListener(emitter, event, fn) {
24975 // Sadly this is not cacheable as some libraries bundle their own
24976 // event emitter implementation with them.
24977 if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
24979 // This is a hack to make sure that our error handler is attached before any
24980 // userland ones. NEVER DO THIS. This is here only because this code needs
24981 // to continue to work with older versions of Node.js that do not include
24982 // the prependListener() method. The goal is to eventually remove this hack.
24983 if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
24986 function ReadableState(options, stream) {
24987 Duplex = Duplex || __webpack_require__(176);
24989 options = options || {};
24991 // Duplex streams are both readable and writable, but share
24992 // the same options object.
24993 // However, some cases require setting options to different
24994 // values for the readable and the writable sides of the duplex stream.
24995 // These options can be provided separately as readableXXX and writableXXX.
24996 var isDuplex = stream instanceof Duplex;
24998 // object stream flag. Used to make read(n) ignore n and to
24999 // make all the buffer merging and length checks go away
25000 this.objectMode = !!options.objectMode;
25002 if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
25004 // the point at which it stops calling _read() to fill the buffer
25005 // Note: 0 is a valid value, means "don't call _read preemptively ever"
25006 var hwm = options.highWaterMark;
25007 var readableHwm = options.readableHighWaterMark;
25008 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
25010 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
25013 this.highWaterMark = Math.floor(this.highWaterMark);
25015 // A linked list is used to store data chunks instead of an array because the
25016 // linked list can remove elements from the beginning faster than
25018 this.buffer = new BufferList();
25021 this.pipesCount = 0;
25022 this.flowing = null;
25023 this.ended = false;
25024 this.endEmitted = false;
25025 this.reading = false;
25027 // a flag to be able to tell if the event 'readable'/'data' is emitted
25028 // immediately, or on a later tick. We set this to true at first, because
25029 // any actions that shouldn't happen until "later" should generally also
25030 // not happen before the first read call.
25033 // whenever we return null, then we set a flag to say
25034 // that we're awaiting a 'readable' event emission.
25035 this.needReadable = false;
25036 this.emittedReadable = false;
25037 this.readableListening = false;
25038 this.resumeScheduled = false;
25040 // has it been destroyed
25041 this.destroyed = false;
25043 // Crypto is kind of old and crusty. Historically, its default string
25044 // encoding is 'binary' so we have to make this configurable.
25045 // Everything else in the universe uses 'utf8', though.
25046 this.defaultEncoding = options.defaultEncoding || 'utf8';
25048 // the number of writers that are awaiting a drain event in .pipe()s
25049 this.awaitDrain = 0;
25051 // if true, a maybeReadMore has been scheduled
25052 this.readingMore = false;
25054 this.decoder = null;
25055 this.encoding = null;
25056 if (options.encoding) {
25057 if (!StringDecoder) StringDecoder = __webpack_require__(179).StringDecoder;
25058 this.decoder = new StringDecoder(options.encoding);
25059 this.encoding = options.encoding;
25063 function Readable(options) {
25064 Duplex = Duplex || __webpack_require__(176);
25066 if (!(this instanceof Readable)) return new Readable(options);
25068 this._readableState = new ReadableState(options, this);
25071 this.readable = true;
25074 if (typeof options.read === 'function') this._read = options.read;
25076 if (typeof options.destroy === 'function') this._destroy = options.destroy;
25082 Object.defineProperty(Readable.prototype, 'destroyed', {
25084 if (this._readableState === undefined) {
25087 return this._readableState.destroyed;
25089 set: function (value) {
25090 // we ignore the value if the stream
25091 // has not been initialized yet
25092 if (!this._readableState) {
25096 // backward compatibility, the user is explicitly
25097 // managing destroyed
25098 this._readableState.destroyed = value;
25102 Readable.prototype.destroy = destroyImpl.destroy;
25103 Readable.prototype._undestroy = destroyImpl.undestroy;
25104 Readable.prototype._destroy = function (err, cb) {
25109 // Manually shove something into the read() buffer.
25110 // This returns true if the highWaterMark has not been hit yet,
25111 // similar to how Writable.write() returns true if you should
25112 // write() some more.
25113 Readable.prototype.push = function (chunk, encoding) {
25114 var state = this._readableState;
25115 var skipChunkCheck;
25117 if (!state.objectMode) {
25118 if (typeof chunk === 'string') {
25119 encoding = encoding || state.defaultEncoding;
25120 if (encoding !== state.encoding) {
25121 chunk = Buffer.from(chunk, encoding);
25124 skipChunkCheck = true;
25127 skipChunkCheck = true;
25130 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
25133 // Unshift should *always* be something directly out of read()
25134 Readable.prototype.unshift = function (chunk) {
25135 return readableAddChunk(this, chunk, null, true, false);
25138 function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
25139 var state = stream._readableState;
25140 if (chunk === null) {
25141 state.reading = false;
25142 onEofChunk(stream, state);
25145 if (!skipChunkCheck) er = chunkInvalid(state, chunk);
25147 stream.emit('error', er);
25148 } else if (state.objectMode || chunk && chunk.length > 0) {
25149 if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
25150 chunk = _uint8ArrayToBuffer(chunk);
25154 if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
25155 } else if (state.ended) {
25156 stream.emit('error', new Error('stream.push() after EOF'));
25158 state.reading = false;
25159 if (state.decoder && !encoding) {
25160 chunk = state.decoder.write(chunk);
25161 if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
25163 addChunk(stream, state, chunk, false);
25166 } else if (!addToFront) {
25167 state.reading = false;
25171 return needMoreData(state);
25174 function addChunk(stream, state, chunk, addToFront) {
25175 if (state.flowing && state.length === 0 && !state.sync) {
25176 stream.emit('data', chunk);
25179 // update the buffer info.
25180 state.length += state.objectMode ? 1 : chunk.length;
25181 if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
25183 if (state.needReadable) emitReadable(stream);
25185 maybeReadMore(stream, state);
25188 function chunkInvalid(state, chunk) {
25190 if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
25191 er = new TypeError('Invalid non-string/buffer chunk');
25196 // if it's past the high water mark, we can push in some more.
25197 // Also, if we have no data yet, we can stand some
25198 // more bytes. This is to work around cases where hwm=0,
25199 // such as the repl. Also, if the push() triggered a
25200 // readable event, and the user called read(largeNumber) such that
25201 // needReadable was set, then we ought to push more, so that another
25202 // 'readable' event will be triggered.
25203 function needMoreData(state) {
25204 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
25207 Readable.prototype.isPaused = function () {
25208 return this._readableState.flowing === false;
25211 // backwards compatibility.
25212 Readable.prototype.setEncoding = function (enc) {
25213 if (!StringDecoder) StringDecoder = __webpack_require__(179).StringDecoder;
25214 this._readableState.decoder = new StringDecoder(enc);
25215 this._readableState.encoding = enc;
25219 // Don't raise the hwm > 8MB
25220 var MAX_HWM = 0x800000;
25221 function computeNewHighWaterMark(n) {
25222 if (n >= MAX_HWM) {
25225 // Get the next highest power of 2 to prevent increasing hwm excessively in
25238 // This function is designed to be inlinable, so please take care when making
25239 // changes to the function body.
25240 function howMuchToRead(n, state) {
25241 if (n <= 0 || state.length === 0 && state.ended) return 0;
25242 if (state.objectMode) return 1;
25244 // Only flow one buffer at a time
25245 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
25247 // If we're asking for more than the current hwm, then raise the hwm.
25248 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
25249 if (n <= state.length) return n;
25250 // Don't have enough
25251 if (!state.ended) {
25252 state.needReadable = true;
25255 return state.length;
25258 // you can override either this method, or the async _read(n) below.
25259 Readable.prototype.read = function (n) {
25261 n = parseInt(n, 10);
25262 var state = this._readableState;
25265 if (n !== 0) state.emittedReadable = false;
25267 // if we're doing read(0) to trigger a readable event, but we
25268 // already have a bunch of data in the buffer, then just trigger
25269 // the 'readable' event and move on.
25270 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
25271 debug('read: emitReadable', state.length, state.ended);
25272 if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
25276 n = howMuchToRead(n, state);
25278 // if we've ended, and we're now clear, then finish it up.
25279 if (n === 0 && state.ended) {
25280 if (state.length === 0) endReadable(this);
25284 // All the actual chunk generation logic needs to be
25285 // *below* the call to _read. The reason is that in certain
25286 // synthetic stream cases, such as passthrough streams, _read
25287 // may be a completely synchronous operation which may change
25288 // the state of the read buffer, providing enough data when
25289 // before there was *not* enough.
25291 // So, the steps are:
25292 // 1. Figure out what the state of things will be after we do
25293 // a read from the buffer.
25295 // 2. If that resulting state will trigger a _read, then call _read.
25296 // Note that this may be asynchronous, or synchronous. Yes, it is
25297 // deeply ugly to write APIs this way, but that still doesn't mean
25298 // that the Readable class should behave improperly, as streams are
25299 // designed to be sync/async agnostic.
25300 // Take note if the _read call is sync or async (ie, if the read call
25301 // has returned yet), so that we know whether or not it's safe to emit
25304 // 3. Actually pull the requested chunks out of the buffer and return.
25306 // if we need a readable event, then we need to do some reading.
25307 var doRead = state.needReadable;
25308 debug('need readable', doRead);
25310 // if we currently have less than the highWaterMark, then also read some
25311 if (state.length === 0 || state.length - n < state.highWaterMark) {
25313 debug('length less than watermark', doRead);
25316 // however, if we've ended, then there's no point, and if we're already
25317 // reading, then it's unnecessary.
25318 if (state.ended || state.reading) {
25320 debug('reading or ended', doRead);
25321 } else if (doRead) {
25323 state.reading = true;
25325 // if the length is currently zero, then we *need* a readable event.
25326 if (state.length === 0) state.needReadable = true;
25327 // call internal read method
25328 this._read(state.highWaterMark);
25329 state.sync = false;
25330 // If _read pushed data synchronously, then `reading` will be false,
25331 // and we need to re-evaluate how much data we can return to the user.
25332 if (!state.reading) n = howMuchToRead(nOrig, state);
25336 if (n > 0) ret = fromList(n, state);else ret = null;
25338 if (ret === null) {
25339 state.needReadable = true;
25345 if (state.length === 0) {
25346 // If we have nothing in the buffer, then we want to know
25347 // as soon as we *do* get something into the buffer.
25348 if (!state.ended) state.needReadable = true;
25350 // If we tried to read() past the EOF, then emit end on the next tick.
25351 if (nOrig !== n && state.ended) endReadable(this);
25354 if (ret !== null) this.emit('data', ret);
25359 function onEofChunk(stream, state) {
25360 if (state.ended) return;
25361 if (state.decoder) {
25362 var chunk = state.decoder.end();
25363 if (chunk && chunk.length) {
25364 state.buffer.push(chunk);
25365 state.length += state.objectMode ? 1 : chunk.length;
25368 state.ended = true;
25370 // emit 'readable' now to make sure it gets picked up.
25371 emitReadable(stream);
25374 // Don't emit readable right away in sync mode, because this can trigger
25375 // another read() call => stack overflow. This way, it might trigger
25376 // a nextTick recursion warning, but that's not so bad.
25377 function emitReadable(stream) {
25378 var state = stream._readableState;
25379 state.needReadable = false;
25380 if (!state.emittedReadable) {
25381 debug('emitReadable', state.flowing);
25382 state.emittedReadable = true;
25383 if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
25387 function emitReadable_(stream) {
25388 debug('emit readable');
25389 stream.emit('readable');
25393 // at this point, the user has presumably seen the 'readable' event,
25394 // and called read() to consume some data. that may have triggered
25395 // in turn another _read(n) call, in which case reading = true if
25396 // it's in progress.
25397 // However, if we're not ended, or reading, and the length < hwm,
25398 // then go ahead and try to read some more preemptively.
25399 function maybeReadMore(stream, state) {
25400 if (!state.readingMore) {
25401 state.readingMore = true;
25402 pna.nextTick(maybeReadMore_, stream, state);
25406 function maybeReadMore_(stream, state) {
25407 var len = state.length;
25408 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
25409 debug('maybeReadMore read 0');
25411 if (len === state.length)
25412 // didn't get any data, stop spinning.
25413 break;else len = state.length;
25415 state.readingMore = false;
25418 // abstract method. to be overridden in specific implementation classes.
25419 // call cb(er, data) where data is <= n in length.
25420 // for virtual (non-string, non-buffer) streams, "length" is somewhat
25421 // arbitrary, and perhaps not very meaningful.
25422 Readable.prototype._read = function (n) {
25423 this.emit('error', new Error('_read() is not implemented'));
25426 Readable.prototype.pipe = function (dest, pipeOpts) {
25428 var state = this._readableState;
25430 switch (state.pipesCount) {
25432 state.pipes = dest;
25435 state.pipes = [state.pipes, dest];
25438 state.pipes.push(dest);
25441 state.pipesCount += 1;
25442 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
25444 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
25446 var endFn = doEnd ? onend : unpipe;
25447 if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
25449 dest.on('unpipe', onunpipe);
25450 function onunpipe(readable, unpipeInfo) {
25452 if (readable === src) {
25453 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
25454 unpipeInfo.hasUnpiped = true;
25465 // when the dest drains, it reduces the awaitDrain counter
25466 // on the source. This would be more elegant with a .once()
25467 // handler in flow(), but adding and removing repeatedly is
25469 var ondrain = pipeOnDrain(src);
25470 dest.on('drain', ondrain);
25472 var cleanedUp = false;
25473 function cleanup() {
25475 // cleanup event handlers once the pipe is broken
25476 dest.removeListener('close', onclose);
25477 dest.removeListener('finish', onfinish);
25478 dest.removeListener('drain', ondrain);
25479 dest.removeListener('error', onerror);
25480 dest.removeListener('unpipe', onunpipe);
25481 src.removeListener('end', onend);
25482 src.removeListener('end', unpipe);
25483 src.removeListener('data', ondata);
25487 // if the reader is waiting for a drain event from this
25488 // specific writer, then it would cause it to never start
25490 // So, if this is awaiting a drain, then we just call it now.
25491 // If we don't know, then assume that we are waiting for one.
25492 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
25495 // If the user pushes more data while we're writing to dest then we'll end up
25496 // in ondata again. However, we only want to increase awaitDrain once because
25497 // dest will only emit one 'drain' event for the multiple writes.
25498 // => Introduce a guard on increasing awaitDrain.
25499 var increasedAwaitDrain = false;
25500 src.on('data', ondata);
25501 function ondata(chunk) {
25503 increasedAwaitDrain = false;
25504 var ret = dest.write(chunk);
25505 if (false === ret && !increasedAwaitDrain) {
25506 // If the user unpiped during `dest.write()`, it is possible
25507 // to get stuck in a permanently paused state if that write
25508 // also returned false.
25509 // => Check whether `dest` is still a piping destination.
25510 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
25511 debug('false write response, pause', src._readableState.awaitDrain);
25512 src._readableState.awaitDrain++;
25513 increasedAwaitDrain = true;
25519 // if the dest has an error, then stop piping into it.
25520 // however, don't suppress the throwing behavior for this.
25521 function onerror(er) {
25522 debug('onerror', er);
25524 dest.removeListener('error', onerror);
25525 if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
25528 // Make sure our error handler is attached before userland ones.
25529 prependListener(dest, 'error', onerror);
25531 // Both close and finish should trigger unpipe, but only once.
25532 function onclose() {
25533 dest.removeListener('finish', onfinish);
25536 dest.once('close', onclose);
25537 function onfinish() {
25539 dest.removeListener('close', onclose);
25542 dest.once('finish', onfinish);
25544 function unpipe() {
25549 // tell the dest that it's being piped to
25550 dest.emit('pipe', src);
25552 // start the flow if it hasn't been started already.
25553 if (!state.flowing) {
25554 debug('pipe resume');
25561 function pipeOnDrain(src) {
25562 return function () {
25563 var state = src._readableState;
25564 debug('pipeOnDrain', state.awaitDrain);
25565 if (state.awaitDrain) state.awaitDrain--;
25566 if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
25567 state.flowing = true;
25573 Readable.prototype.unpipe = function (dest) {
25574 var state = this._readableState;
25575 var unpipeInfo = { hasUnpiped: false };
25577 // if we're not piping anywhere, then do nothing.
25578 if (state.pipesCount === 0) return this;
25580 // just one destination. most common case.
25581 if (state.pipesCount === 1) {
25582 // passed in one, but it's not the right one.
25583 if (dest && dest !== state.pipes) return this;
25585 if (!dest) dest = state.pipes;
25588 state.pipes = null;
25589 state.pipesCount = 0;
25590 state.flowing = false;
25591 if (dest) dest.emit('unpipe', this, unpipeInfo);
25595 // slow case. multiple pipe destinations.
25599 var dests = state.pipes;
25600 var len = state.pipesCount;
25601 state.pipes = null;
25602 state.pipesCount = 0;
25603 state.flowing = false;
25605 for (var i = 0; i < len; i++) {
25606 dests[i].emit('unpipe', this, unpipeInfo);
25610 // try to find the right one.
25611 var index = indexOf(state.pipes, dest);
25612 if (index === -1) return this;
25614 state.pipes.splice(index, 1);
25615 state.pipesCount -= 1;
25616 if (state.pipesCount === 1) state.pipes = state.pipes[0];
25618 dest.emit('unpipe', this, unpipeInfo);
25623 // set up data events if they are asked for
25624 // Ensure readable listeners eventually get something
25625 Readable.prototype.on = function (ev, fn) {
25626 var res = Stream.prototype.on.call(this, ev, fn);
25628 if (ev === 'data') {
25629 // Start flowing on next tick if stream isn't explicitly paused
25630 if (this._readableState.flowing !== false) this.resume();
25631 } else if (ev === 'readable') {
25632 var state = this._readableState;
25633 if (!state.endEmitted && !state.readableListening) {
25634 state.readableListening = state.needReadable = true;
25635 state.emittedReadable = false;
25636 if (!state.reading) {
25637 pna.nextTick(nReadingNextTick, this);
25638 } else if (state.length) {
25639 emitReadable(this);
25646 Readable.prototype.addListener = Readable.prototype.on;
25648 function nReadingNextTick(self) {
25649 debug('readable nexttick read 0');
25653 // pause() and resume() are remnants of the legacy readable stream API
25654 // If the user uses them, then switch into old mode.
25655 Readable.prototype.resume = function () {
25656 var state = this._readableState;
25657 if (!state.flowing) {
25659 state.flowing = true;
25660 resume(this, state);
25665 function resume(stream, state) {
25666 if (!state.resumeScheduled) {
25667 state.resumeScheduled = true;
25668 pna.nextTick(resume_, stream, state);
25672 function resume_(stream, state) {
25673 if (!state.reading) {
25674 debug('resume read 0');
25678 state.resumeScheduled = false;
25679 state.awaitDrain = 0;
25680 stream.emit('resume');
25682 if (state.flowing && !state.reading) stream.read(0);
25685 Readable.prototype.pause = function () {
25686 debug('call pause flowing=%j', this._readableState.flowing);
25687 if (false !== this._readableState.flowing) {
25689 this._readableState.flowing = false;
25690 this.emit('pause');
25695 function flow(stream) {
25696 var state = stream._readableState;
25697 debug('flow', state.flowing);
25698 while (state.flowing && stream.read() !== null) {}
25701 // wrap an old-style stream as the async data source.
25702 // This is *not* part of the readable stream interface.
25703 // It is an ugly unfortunate mess of history.
25704 Readable.prototype.wrap = function (stream) {
25707 var state = this._readableState;
25708 var paused = false;
25710 stream.on('end', function () {
25711 debug('wrapped end');
25712 if (state.decoder && !state.ended) {
25713 var chunk = state.decoder.end();
25714 if (chunk && chunk.length) _this.push(chunk);
25720 stream.on('data', function (chunk) {
25721 debug('wrapped data');
25722 if (state.decoder) chunk = state.decoder.write(chunk);
25724 // don't skip over falsy values in objectMode
25725 if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
25727 var ret = _this.push(chunk);
25734 // proxy all the other methods.
25735 // important when wrapping filters and duplexes.
25736 for (var i in stream) {
25737 if (this[i] === undefined && typeof stream[i] === 'function') {
25738 this[i] = function (method) {
25739 return function () {
25740 return stream[method].apply(stream, arguments);
25746 // proxy certain important events.
25747 for (var n = 0; n < kProxyEvents.length; n++) {
25748 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
25751 // when we try to consume some more bytes, simply unpause the
25752 // underlying stream.
25753 this._read = function (n) {
25754 debug('wrapped _read', n);
25764 Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
25765 // making it explicit this property is not enumerable
25766 // because otherwise some prototype manipulation in
25767 // userland will fail
25770 return this._readableState.highWaterMark;
25774 // exposed for testing purposes only.
25775 Readable._fromList = fromList;
25777 // Pluck off n bytes from an array of buffers.
25778 // Length is the combined lengths of all the buffers in the list.
25779 // This function is designed to be inlinable, so please take care when making
25780 // changes to the function body.
25781 function fromList(n, state) {
25782 // nothing buffered
25783 if (state.length === 0) return null;
25786 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
25787 // read it all, truncate the list
25788 if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
25789 state.buffer.clear();
25791 // read part of list
25792 ret = fromListPartial(n, state.buffer, state.decoder);
25798 // Extracts only enough buffered data to satisfy the amount requested.
25799 // This function is designed to be inlinable, so please take care when making
25800 // changes to the function body.
25801 function fromListPartial(n, list, hasStrings) {
25803 if (n < list.head.data.length) {
25804 // slice is the same for buffers and strings
25805 ret = list.head.data.slice(0, n);
25806 list.head.data = list.head.data.slice(n);
25807 } else if (n === list.head.data.length) {
25808 // first chunk is a perfect match
25809 ret = list.shift();
25811 // result spans more than one buffer
25812 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
25817 // Copies a specified amount of characters from the list of buffered data
25819 // This function is designed to be inlinable, so please take care when making
25820 // changes to the function body.
25821 function copyFromBufferString(n, list) {
25826 while (p = p.next) {
25828 var nb = n > str.length ? str.length : n;
25829 if (nb === str.length) ret += str;else ret += str.slice(0, n);
25832 if (nb === str.length) {
25834 if (p.next) list.head = p.next;else list.head = list.tail = null;
25837 p.data = str.slice(nb);
25847 // Copies a specified amount of bytes from the list of buffered data chunks.
25848 // This function is designed to be inlinable, so please take care when making
25849 // changes to the function body.
25850 function copyFromBuffer(n, list) {
25851 var ret = Buffer.allocUnsafe(n);
25855 n -= p.data.length;
25856 while (p = p.next) {
25858 var nb = n > buf.length ? buf.length : n;
25859 buf.copy(ret, ret.length - n, 0, nb);
25862 if (nb === buf.length) {
25864 if (p.next) list.head = p.next;else list.head = list.tail = null;
25867 p.data = buf.slice(nb);
25877 function endReadable(stream) {
25878 var state = stream._readableState;
25880 // If we get here before consuming all the bytes, then that is a
25881 // bug in node. Should never happen.
25882 if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
25884 if (!state.endEmitted) {
25885 state.ended = true;
25886 pna.nextTick(endReadableNT, state, stream);
25890 function endReadableNT(state, stream) {
25891 // Check that we didn't get one last unshift.
25892 if (!state.endEmitted && state.length === 0) {
25893 state.endEmitted = true;
25894 stream.readable = false;
25895 stream.emit('end');
25899 function indexOf(xs, x) {
25900 for (var i = 0, l = xs.length; i < l; i++) {
25901 if (xs[i] === x) return i;
25908 /***/ ((module) => {
25913 if (typeof process === 'undefined' ||
25914 !process.version ||
25915 process.version.indexOf('v0.') === 0 ||
25916 process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
25917 module.exports = { nextTick: nextTick };
25919 module.exports = process
25922 function nextTick(fn, arg1, arg2, arg3) {
25923 if (typeof fn !== 'function') {
25924 throw new TypeError('"callback" argument must be a function');
25926 var len = arguments.length;
25931 return process.nextTick(fn);
25933 return process.nextTick(function afterTickOne() {
25934 fn.call(null, arg1);
25937 return process.nextTick(function afterTickTwo() {
25938 fn.call(null, arg1, arg2);
25941 return process.nextTick(function afterTickThree() {
25942 fn.call(null, arg1, arg2, arg3);
25945 args = new Array(len - 1);
25947 while (i < args.length) {
25948 args[i++] = arguments[i];
25950 return process.nextTick(function afterTick() {
25951 fn.apply(null, args);
25960 /***/ ((module) => {
25962 var toString = {}.toString;
25964 module.exports = Array.isArray || function (arr) {
25965 return toString.call(arr) == '[object Array]';
25971 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
25973 module.exports = __webpack_require__(44);
25978 /***/ ((module, exports, __webpack_require__) => {
25980 /* eslint-disable node/no-deprecated-api */
25981 var buffer = __webpack_require__(166)
25982 var Buffer = buffer.Buffer
25984 // alternative to using Object.keys for old browsers
25985 function copyProps (src, dst) {
25986 for (var key in src) {
25987 dst[key] = src[key]
25990 if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
25991 module.exports = buffer
25993 // Copy properties from require('buffer')
25994 copyProps(buffer, exports)
25995 exports.Buffer = SafeBuffer
25998 function SafeBuffer (arg, encodingOrOffset, length) {
25999 return Buffer(arg, encodingOrOffset, length)
26002 // Copy static methods from Buffer
26003 copyProps(Buffer, SafeBuffer)
26005 SafeBuffer.from = function (arg, encodingOrOffset, length) {
26006 if (typeof arg === 'number') {
26007 throw new TypeError('Argument must not be a number')
26009 return Buffer(arg, encodingOrOffset, length)
26012 SafeBuffer.alloc = function (size, fill, encoding) {
26013 if (typeof size !== 'number') {
26014 throw new TypeError('Argument must be a number')
26016 var buf = Buffer(size)
26017 if (fill !== undefined) {
26018 if (typeof encoding === 'string') {
26019 buf.fill(fill, encoding)
26029 SafeBuffer.allocUnsafe = function (size) {
26030 if (typeof size !== 'number') {
26031 throw new TypeError('Argument must be a number')
26033 return Buffer(size)
26036 SafeBuffer.allocUnsafeSlow = function (size) {
26037 if (typeof size !== 'number') {
26038 throw new TypeError('Argument must be a number')
26040 return buffer.SlowBuffer(size)
26046 /***/ ((__unused_webpack_module, exports) => {
26048 // Copyright Joyent, Inc. and other Node contributors.
26050 // Permission is hereby granted, free of charge, to any person obtaining a
26051 // copy of this software and associated documentation files (the
26052 // "Software"), to deal in the Software without restriction, including
26053 // without limitation the rights to use, copy, modify, merge, publish,
26054 // distribute, sublicense, and/or sell copies of the Software, and to permit
26055 // persons to whom the Software is furnished to do so, subject to the
26056 // following conditions:
26058 // The above copyright notice and this permission notice shall be included
26059 // in all copies or substantial portions of the Software.
26061 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26062 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26063 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26064 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26065 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26066 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26067 // USE OR OTHER DEALINGS IN THE SOFTWARE.
26069 // NOTE: These type checking functions intentionally don't use `instanceof`
26070 // because it is fragile and can be easily faked with `Object.create()`.
26072 function isArray(arg) {
26073 if (Array.isArray) {
26074 return Array.isArray(arg);
26076 return objectToString(arg) === '[object Array]';
26078 exports.isArray = isArray;
26080 function isBoolean(arg) {
26081 return typeof arg === 'boolean';
26083 exports.isBoolean = isBoolean;
26085 function isNull(arg) {
26086 return arg === null;
26088 exports.isNull = isNull;
26090 function isNullOrUndefined(arg) {
26091 return arg == null;
26093 exports.isNullOrUndefined = isNullOrUndefined;
26095 function isNumber(arg) {
26096 return typeof arg === 'number';
26098 exports.isNumber = isNumber;
26100 function isString(arg) {
26101 return typeof arg === 'string';
26103 exports.isString = isString;
26105 function isSymbol(arg) {
26106 return typeof arg === 'symbol';
26108 exports.isSymbol = isSymbol;
26110 function isUndefined(arg) {
26111 return arg === void 0;
26113 exports.isUndefined = isUndefined;
26115 function isRegExp(re) {
26116 return objectToString(re) === '[object RegExp]';
26118 exports.isRegExp = isRegExp;
26120 function isObject(arg) {
26121 return typeof arg === 'object' && arg !== null;
26123 exports.isObject = isObject;
26125 function isDate(d) {
26126 return objectToString(d) === '[object Date]';
26128 exports.isDate = isDate;
26130 function isError(e) {
26131 return (objectToString(e) === '[object Error]' || e instanceof Error);
26133 exports.isError = isError;
26135 function isFunction(arg) {
26136 return typeof arg === 'function';
26138 exports.isFunction = isFunction;
26140 function isPrimitive(arg) {
26141 return arg === null ||
26142 typeof arg === 'boolean' ||
26143 typeof arg === 'number' ||
26144 typeof arg === 'string' ||
26145 typeof arg === 'symbol' || // ES6 symbol
26146 typeof arg === 'undefined';
26148 exports.isPrimitive = isPrimitive;
26150 exports.isBuffer = Buffer.isBuffer;
26152 function objectToString(o) {
26153 return Object.prototype.toString.call(o);
26159 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
26164 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26166 var Buffer = __webpack_require__(172).Buffer;
26167 var util = __webpack_require__(50);
26169 function copyBuffer(src, target, offset) {
26170 src.copy(target, offset);
26173 module.exports = function () {
26174 function BufferList() {
26175 _classCallCheck(this, BufferList);
26182 BufferList.prototype.push = function push(v) {
26183 var entry = { data: v, next: null };
26184 if (this.length > 0) this.tail.next = entry;else this.head = entry;
26189 BufferList.prototype.unshift = function unshift(v) {
26190 var entry = { data: v, next: this.head };
26191 if (this.length === 0) this.tail = entry;
26196 BufferList.prototype.shift = function shift() {
26197 if (this.length === 0) return;
26198 var ret = this.head.data;
26199 if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
26204 BufferList.prototype.clear = function clear() {
26205 this.head = this.tail = null;
26209 BufferList.prototype.join = function join(s) {
26210 if (this.length === 0) return '';
26212 var ret = '' + p.data;
26213 while (p = p.next) {
26218 BufferList.prototype.concat = function concat(n) {
26219 if (this.length === 0) return Buffer.alloc(0);
26220 if (this.length === 1) return this.head.data;
26221 var ret = Buffer.allocUnsafe(n >>> 0);
26225 copyBuffer(p.data, ret, i);
26226 i += p.data.length;
26235 if (util && util.inspect && util.inspect.custom) {
26236 module.exports.prototype[util.inspect.custom] = function () {
26237 var obj = util.inspect({ length: this.length });
26238 return this.constructor.name + ' ' + obj;
26244 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
26251 var pna = __webpack_require__(169);
26254 // undocumented cb() API, needed for core, not for public API
26255 function destroy(err, cb) {
26258 var readableDestroyed = this._readableState && this._readableState.destroyed;
26259 var writableDestroyed = this._writableState && this._writableState.destroyed;
26261 if (readableDestroyed || writableDestroyed) {
26264 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
26265 pna.nextTick(emitErrorNT, this, err);
26270 // we set destroyed to true before firing error callbacks in order
26271 // to make it re-entrance safe in case destroy() is called within callbacks
26273 if (this._readableState) {
26274 this._readableState.destroyed = true;
26277 // if this is a duplex stream mark the writable part as destroyed as well
26278 if (this._writableState) {
26279 this._writableState.destroyed = true;
26282 this._destroy(err || null, function (err) {
26284 pna.nextTick(emitErrorNT, _this, err);
26285 if (_this._writableState) {
26286 _this._writableState.errorEmitted = true;
26296 function undestroy() {
26297 if (this._readableState) {
26298 this._readableState.destroyed = false;
26299 this._readableState.reading = false;
26300 this._readableState.ended = false;
26301 this._readableState.endEmitted = false;
26304 if (this._writableState) {
26305 this._writableState.destroyed = false;
26306 this._writableState.ended = false;
26307 this._writableState.ending = false;
26308 this._writableState.finished = false;
26309 this._writableState.errorEmitted = false;
26313 function emitErrorNT(self, err) {
26314 self.emit('error', err);
26319 undestroy: undestroy
26324 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
26327 // Copyright Joyent, Inc. and other Node contributors.
26329 // Permission is hereby granted, free of charge, to any person obtaining a
26330 // copy of this software and associated documentation files (the
26331 // "Software"), to deal in the Software without restriction, including
26332 // without limitation the rights to use, copy, modify, merge, publish,
26333 // distribute, sublicense, and/or sell copies of the Software, and to permit
26334 // persons to whom the Software is furnished to do so, subject to the
26335 // following conditions:
26337 // The above copyright notice and this permission notice shall be included
26338 // in all copies or substantial portions of the Software.
26340 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26341 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26342 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26343 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26344 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26345 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26346 // USE OR OTHER DEALINGS IN THE SOFTWARE.
26348 // a duplex stream is just a stream that is both readable and writable.
26349 // Since JS doesn't have multiple prototypal inheritance, this class
26350 // prototypally inherits from Readable, and then parasitically from
26357 var pna = __webpack_require__(169);
26361 var objectKeys = Object.keys || function (obj) {
26363 for (var key in obj) {
26369 module.exports = Duplex;
26372 var util = Object.create(__webpack_require__(173));
26373 util.inherits = __webpack_require__(66);
26376 var Readable = __webpack_require__(168);
26377 var Writable = __webpack_require__(177);
26379 util.inherits(Duplex, Readable);
26382 // avoid scope creep, the keys array can then be collected
26383 var keys = objectKeys(Writable.prototype);
26384 for (var v = 0; v < keys.length; v++) {
26385 var method = keys[v];
26386 if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
26390 function Duplex(options) {
26391 if (!(this instanceof Duplex)) return new Duplex(options);
26393 Readable.call(this, options);
26394 Writable.call(this, options);
26396 if (options && options.readable === false) this.readable = false;
26398 if (options && options.writable === false) this.writable = false;
26400 this.allowHalfOpen = true;
26401 if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
26403 this.once('end', onend);
26406 Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
26407 // making it explicit this property is not enumerable
26408 // because otherwise some prototype manipulation in
26409 // userland will fail
26412 return this._writableState.highWaterMark;
26416 // the no-half-open enforcer
26418 // if we allow half-open state, or if the writable side ended,
26420 if (this.allowHalfOpen || this._writableState.ended) return;
26422 // no more data can be written.
26423 // But allow more writes to happen in this tick.
26424 pna.nextTick(onEndNT, this);
26427 function onEndNT(self) {
26431 Object.defineProperty(Duplex.prototype, 'destroyed', {
26433 if (this._readableState === undefined || this._writableState === undefined) {
26436 return this._readableState.destroyed && this._writableState.destroyed;
26438 set: function (value) {
26439 // we ignore the value if the stream
26440 // has not been initialized yet
26441 if (this._readableState === undefined || this._writableState === undefined) {
26445 // backward compatibility, the user is explicitly
26446 // managing destroyed
26447 this._readableState.destroyed = value;
26448 this._writableState.destroyed = value;
26452 Duplex.prototype._destroy = function (err, cb) {
26456 pna.nextTick(cb, err);
26461 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
26464 // Copyright Joyent, Inc. and other Node contributors.
26466 // Permission is hereby granted, free of charge, to any person obtaining a
26467 // copy of this software and associated documentation files (the
26468 // "Software"), to deal in the Software without restriction, including
26469 // without limitation the rights to use, copy, modify, merge, publish,
26470 // distribute, sublicense, and/or sell copies of the Software, and to permit
26471 // persons to whom the Software is furnished to do so, subject to the
26472 // following conditions:
26474 // The above copyright notice and this permission notice shall be included
26475 // in all copies or substantial portions of the Software.
26477 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26478 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26479 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26480 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26481 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26482 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26483 // USE OR OTHER DEALINGS IN THE SOFTWARE.
26485 // A bit simpler than readable streams.
26486 // Implement an async ._write(chunk, encoding, cb), and it'll handle all
26487 // the drain event emission and buffering.
26493 var pna = __webpack_require__(169);
26496 module.exports = Writable;
26498 /* <replacement> */
26499 function WriteReq(chunk, encoding, cb) {
26500 this.chunk = chunk;
26501 this.encoding = encoding;
26502 this.callback = cb;
26506 // It seems a linked list but it is not
26507 // there will be only 2 of these for each stream
26508 function CorkedRequest(state) {
26513 this.finish = function () {
26514 onCorkedFinish(_this, state);
26517 /* </replacement> */
26520 var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
26527 Writable.WritableState = WritableState;
26530 var util = Object.create(__webpack_require__(173));
26531 util.inherits = __webpack_require__(66);
26535 var internalUtil = {
26536 deprecate: __webpack_require__(178)
26541 var Stream = __webpack_require__(171);
26546 var Buffer = __webpack_require__(172).Buffer;
26547 var OurUint8Array = global.Uint8Array || function () {};
26548 function _uint8ArrayToBuffer(chunk) {
26549 return Buffer.from(chunk);
26551 function _isUint8Array(obj) {
26552 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
26557 var destroyImpl = __webpack_require__(175);
26559 util.inherits(Writable, Stream);
26563 function WritableState(options, stream) {
26564 Duplex = Duplex || __webpack_require__(176);
26566 options = options || {};
26568 // Duplex streams are both readable and writable, but share
26569 // the same options object.
26570 // However, some cases require setting options to different
26571 // values for the readable and the writable sides of the duplex stream.
26572 // These options can be provided separately as readableXXX and writableXXX.
26573 var isDuplex = stream instanceof Duplex;
26575 // object stream flag to indicate whether or not this stream
26576 // contains buffers or objects.
26577 this.objectMode = !!options.objectMode;
26579 if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
26581 // the point at which write() starts returning false
26582 // Note: 0 is a valid value, means that we always return false if
26583 // the entire buffer is not flushed immediately on write()
26584 var hwm = options.highWaterMark;
26585 var writableHwm = options.writableHighWaterMark;
26586 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
26588 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
26591 this.highWaterMark = Math.floor(this.highWaterMark);
26593 // if _final has been called
26594 this.finalCalled = false;
26596 // drain event flag.
26597 this.needDrain = false;
26598 // at the start of calling end()
26599 this.ending = false;
26600 // when end() has been called, and returned
26601 this.ended = false;
26602 // when 'finish' is emitted
26603 this.finished = false;
26605 // has it been destroyed
26606 this.destroyed = false;
26608 // should we decode strings into buffers before passing to _write?
26609 // this is here so that some node-core streams can optimize string
26610 // handling at a lower level.
26611 var noDecode = options.decodeStrings === false;
26612 this.decodeStrings = !noDecode;
26614 // Crypto is kind of old and crusty. Historically, its default string
26615 // encoding is 'binary' so we have to make this configurable.
26616 // Everything else in the universe uses 'utf8', though.
26617 this.defaultEncoding = options.defaultEncoding || 'utf8';
26619 // not an actual buffer we keep track of, but a measurement
26620 // of how much we're waiting to get pushed to some underlying
26624 // a flag to see when we're in the middle of a write.
26625 this.writing = false;
26627 // when true all writes will be buffered until .uncork() call
26630 // a flag to be able to tell if the onwrite cb is called immediately,
26631 // or on a later tick. We set this to true at first, because any
26632 // actions that shouldn't happen until "later" should generally also
26633 // not happen before the first write call.
26636 // a flag to know if we're processing previously buffered items, which
26637 // may call the _write() callback in the same tick, so that we don't
26638 // end up in an overlapped onwrite situation.
26639 this.bufferProcessing = false;
26641 // the callback that's passed to _write(chunk,cb)
26642 this.onwrite = function (er) {
26643 onwrite(stream, er);
26646 // the callback that the user supplies to write(chunk,encoding,cb)
26647 this.writecb = null;
26649 // the amount that is being written when _write is called.
26652 this.bufferedRequest = null;
26653 this.lastBufferedRequest = null;
26655 // number of pending user-supplied write callbacks
26656 // this must be 0 before 'finish' can be emitted
26657 this.pendingcb = 0;
26659 // emit prefinish if the only thing we're waiting for is _write cbs
26660 // This is relevant for synchronous Transform streams
26661 this.prefinished = false;
26663 // True if the error was already emitted and should not be thrown again
26664 this.errorEmitted = false;
26666 // count buffered requests
26667 this.bufferedRequestCount = 0;
26669 // allocate the first CorkedRequest, there is always
26670 // one allocated and free to use, and we maintain at most two
26671 this.corkedRequestsFree = new CorkedRequest(this);
26674 WritableState.prototype.getBuffer = function getBuffer() {
26675 var current = this.bufferedRequest;
26679 current = current.next;
26686 Object.defineProperty(WritableState.prototype, 'buffer', {
26687 get: internalUtil.deprecate(function () {
26688 return this.getBuffer();
26689 }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
26694 // Test _writableState for inheritance to account for Duplex streams,
26695 // whose prototype chain only points to Readable.
26696 var realHasInstance;
26697 if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
26698 realHasInstance = Function.prototype[Symbol.hasInstance];
26699 Object.defineProperty(Writable, Symbol.hasInstance, {
26700 value: function (object) {
26701 if (realHasInstance.call(this, object)) return true;
26702 if (this !== Writable) return false;
26704 return object && object._writableState instanceof WritableState;
26708 realHasInstance = function (object) {
26709 return object instanceof this;
26713 function Writable(options) {
26714 Duplex = Duplex || __webpack_require__(176);
26716 // Writable ctor is applied to Duplexes, too.
26717 // `realHasInstance` is necessary because using plain `instanceof`
26718 // would return false, as no `_writableState` property is attached.
26720 // Trying to use the custom `instanceof` for Writable here will also break the
26721 // Node.js LazyTransform implementation, which has a non-trivial getter for
26722 // `_writableState` that would lead to infinite recursion.
26723 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
26724 return new Writable(options);
26727 this._writableState = new WritableState(options, this);
26730 this.writable = true;
26733 if (typeof options.write === 'function') this._write = options.write;
26735 if (typeof options.writev === 'function') this._writev = options.writev;
26737 if (typeof options.destroy === 'function') this._destroy = options.destroy;
26739 if (typeof options.final === 'function') this._final = options.final;
26745 // Otherwise people can pipe Writable streams, which is just wrong.
26746 Writable.prototype.pipe = function () {
26747 this.emit('error', new Error('Cannot pipe, not readable'));
26750 function writeAfterEnd(stream, cb) {
26751 var er = new Error('write after end');
26752 // TODO: defer error events consistently everywhere, not just the cb
26753 stream.emit('error', er);
26754 pna.nextTick(cb, er);
26757 // Checks that a user-supplied chunk is valid, especially for the particular
26758 // mode the stream is in. Currently this means that `null` is never accepted
26759 // and undefined/non-string values are only allowed in object mode.
26760 function validChunk(stream, state, chunk, cb) {
26764 if (chunk === null) {
26765 er = new TypeError('May not write null values to stream');
26766 } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
26767 er = new TypeError('Invalid non-string/buffer chunk');
26770 stream.emit('error', er);
26771 pna.nextTick(cb, er);
26777 Writable.prototype.write = function (chunk, encoding, cb) {
26778 var state = this._writableState;
26780 var isBuf = !state.objectMode && _isUint8Array(chunk);
26782 if (isBuf && !Buffer.isBuffer(chunk)) {
26783 chunk = _uint8ArrayToBuffer(chunk);
26786 if (typeof encoding === 'function') {
26791 if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
26793 if (typeof cb !== 'function') cb = nop;
26795 if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
26797 ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
26803 Writable.prototype.cork = function () {
26804 var state = this._writableState;
26809 Writable.prototype.uncork = function () {
26810 var state = this._writableState;
26812 if (state.corked) {
26815 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
26819 Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
26820 // node::ParseEncoding() requires lower case.
26821 if (typeof encoding === 'string') encoding = encoding.toLowerCase();
26822 if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
26823 this._writableState.defaultEncoding = encoding;
26827 function decodeChunk(state, chunk, encoding) {
26828 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
26829 chunk = Buffer.from(chunk, encoding);
26834 Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
26835 // making it explicit this property is not enumerable
26836 // because otherwise some prototype manipulation in
26837 // userland will fail
26840 return this._writableState.highWaterMark;
26844 // if we're already writing something, then just put this
26845 // in the queue, and wait our turn. Otherwise, call _write
26846 // If we return false, then we need a drain event, so set that flag.
26847 function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
26849 var newChunk = decodeChunk(state, chunk, encoding);
26850 if (chunk !== newChunk) {
26852 encoding = 'buffer';
26856 var len = state.objectMode ? 1 : chunk.length;
26858 state.length += len;
26860 var ret = state.length < state.highWaterMark;
26861 // we must ensure that previous needDrain will not be reset to false.
26862 if (!ret) state.needDrain = true;
26864 if (state.writing || state.corked) {
26865 var last = state.lastBufferedRequest;
26866 state.lastBufferedRequest = {
26868 encoding: encoding,
26874 last.next = state.lastBufferedRequest;
26876 state.bufferedRequest = state.lastBufferedRequest;
26878 state.bufferedRequestCount += 1;
26880 doWrite(stream, state, false, len, chunk, encoding, cb);
26886 function doWrite(stream, state, writev, len, chunk, encoding, cb) {
26887 state.writelen = len;
26888 state.writecb = cb;
26889 state.writing = true;
26891 if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
26892 state.sync = false;
26895 function onwriteError(stream, state, sync, er, cb) {
26899 // defer the callback if we are being called synchronously
26900 // to avoid piling up things on the stack
26901 pna.nextTick(cb, er);
26902 // this can emit finish, and it will always happen
26904 pna.nextTick(finishMaybe, stream, state);
26905 stream._writableState.errorEmitted = true;
26906 stream.emit('error', er);
26908 // the caller expect this to happen before if
26911 stream._writableState.errorEmitted = true;
26912 stream.emit('error', er);
26913 // this can emit finish, but finish must
26914 // always follow error
26915 finishMaybe(stream, state);
26919 function onwriteStateUpdate(state) {
26920 state.writing = false;
26921 state.writecb = null;
26922 state.length -= state.writelen;
26923 state.writelen = 0;
26926 function onwrite(stream, er) {
26927 var state = stream._writableState;
26928 var sync = state.sync;
26929 var cb = state.writecb;
26931 onwriteStateUpdate(state);
26933 if (er) onwriteError(stream, state, sync, er, cb);else {
26934 // Check if we're actually ready to finish, but don't emit yet
26935 var finished = needFinish(state);
26937 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
26938 clearBuffer(stream, state);
26943 asyncWrite(afterWrite, stream, state, finished, cb);
26946 afterWrite(stream, state, finished, cb);
26951 function afterWrite(stream, state, finished, cb) {
26952 if (!finished) onwriteDrain(stream, state);
26955 finishMaybe(stream, state);
26958 // Must force callback to be called on nextTick, so that we don't
26959 // emit 'drain' before the write() consumer gets the 'false' return
26960 // value, and has a chance to attach a 'drain' listener.
26961 function onwriteDrain(stream, state) {
26962 if (state.length === 0 && state.needDrain) {
26963 state.needDrain = false;
26964 stream.emit('drain');
26968 // if there's something in the buffer waiting, then process it
26969 function clearBuffer(stream, state) {
26970 state.bufferProcessing = true;
26971 var entry = state.bufferedRequest;
26973 if (stream._writev && entry && entry.next) {
26974 // Fast case, write everything using _writev()
26975 var l = state.bufferedRequestCount;
26976 var buffer = new Array(l);
26977 var holder = state.corkedRequestsFree;
26978 holder.entry = entry;
26981 var allBuffers = true;
26983 buffer[count] = entry;
26984 if (!entry.isBuf) allBuffers = false;
26985 entry = entry.next;
26988 buffer.allBuffers = allBuffers;
26990 doWrite(stream, state, true, state.length, buffer, '', holder.finish);
26992 // doWrite is almost always async, defer these to save a bit of time
26993 // as the hot path ends with doWrite
26995 state.lastBufferedRequest = null;
26997 state.corkedRequestsFree = holder.next;
26998 holder.next = null;
27000 state.corkedRequestsFree = new CorkedRequest(state);
27002 state.bufferedRequestCount = 0;
27004 // Slow case, write chunks one-by-one
27006 var chunk = entry.chunk;
27007 var encoding = entry.encoding;
27008 var cb = entry.callback;
27009 var len = state.objectMode ? 1 : chunk.length;
27011 doWrite(stream, state, false, len, chunk, encoding, cb);
27012 entry = entry.next;
27013 state.bufferedRequestCount--;
27014 // if we didn't call the onwrite immediately, then
27015 // it means that we need to wait until it does.
27016 // also, that means that the chunk and cb are currently
27017 // being processed, so move the buffer counter past them.
27018 if (state.writing) {
27023 if (entry === null) state.lastBufferedRequest = null;
27026 state.bufferedRequest = entry;
27027 state.bufferProcessing = false;
27030 Writable.prototype._write = function (chunk, encoding, cb) {
27031 cb(new Error('_write() is not implemented'));
27034 Writable.prototype._writev = null;
27036 Writable.prototype.end = function (chunk, encoding, cb) {
27037 var state = this._writableState;
27039 if (typeof chunk === 'function') {
27043 } else if (typeof encoding === 'function') {
27048 if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
27050 // .end() fully uncorks
27051 if (state.corked) {
27056 // ignore unnecessary end() calls.
27057 if (!state.ending && !state.finished) endWritable(this, state, cb);
27060 function needFinish(state) {
27061 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
27063 function callFinal(stream, state) {
27064 stream._final(function (err) {
27067 stream.emit('error', err);
27069 state.prefinished = true;
27070 stream.emit('prefinish');
27071 finishMaybe(stream, state);
27074 function prefinish(stream, state) {
27075 if (!state.prefinished && !state.finalCalled) {
27076 if (typeof stream._final === 'function') {
27078 state.finalCalled = true;
27079 pna.nextTick(callFinal, stream, state);
27081 state.prefinished = true;
27082 stream.emit('prefinish');
27087 function finishMaybe(stream, state) {
27088 var need = needFinish(state);
27090 prefinish(stream, state);
27091 if (state.pendingcb === 0) {
27092 state.finished = true;
27093 stream.emit('finish');
27099 function endWritable(stream, state, cb) {
27100 state.ending = true;
27101 finishMaybe(stream, state);
27103 if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
27105 state.ended = true;
27106 stream.writable = false;
27109 function onCorkedFinish(corkReq, state, err) {
27110 var entry = corkReq.entry;
27111 corkReq.entry = null;
27113 var cb = entry.callback;
27116 entry = entry.next;
27118 if (state.corkedRequestsFree) {
27119 state.corkedRequestsFree.next = corkReq;
27121 state.corkedRequestsFree = corkReq;
27125 Object.defineProperty(Writable.prototype, 'destroyed', {
27127 if (this._writableState === undefined) {
27130 return this._writableState.destroyed;
27132 set: function (value) {
27133 // we ignore the value if the stream
27134 // has not been initialized yet
27135 if (!this._writableState) {
27139 // backward compatibility, the user is explicitly
27140 // managing destroyed
27141 this._writableState.destroyed = value;
27145 Writable.prototype.destroy = destroyImpl.destroy;
27146 Writable.prototype._undestroy = destroyImpl.undestroy;
27147 Writable.prototype._destroy = function (err, cb) {
27154 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27158 * For Node.js, simply re-export the core `util.deprecate` function.
27161 module.exports = __webpack_require__(50).deprecate;
27166 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
27169 // Copyright Joyent, Inc. and other Node contributors.
27171 // Permission is hereby granted, free of charge, to any person obtaining a
27172 // copy of this software and associated documentation files (the
27173 // "Software"), to deal in the Software without restriction, including
27174 // without limitation the rights to use, copy, modify, merge, publish,
27175 // distribute, sublicense, and/or sell copies of the Software, and to permit
27176 // persons to whom the Software is furnished to do so, subject to the
27177 // following conditions:
27179 // The above copyright notice and this permission notice shall be included
27180 // in all copies or substantial portions of the Software.
27182 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27183 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27184 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27185 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27186 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27187 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
27188 // USE OR OTHER DEALINGS IN THE SOFTWARE.
27194 var Buffer = __webpack_require__(172).Buffer;
27197 var isEncoding = Buffer.isEncoding || function (encoding) {
27198 encoding = '' + encoding;
27199 switch (encoding && encoding.toLowerCase()) {
27200 case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
27207 function _normalizeEncoding(enc) {
27208 if (!enc) return 'utf8';
27228 if (retried) return; // undefined
27229 enc = ('' + enc).toLowerCase();
27235 // Do not cache `Buffer.isEncoding` when checking encoding names as some
27236 // modules monkey-patch it to support additional encodings
27237 function normalizeEncoding(enc) {
27238 var nenc = _normalizeEncoding(enc);
27239 if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
27240 return nenc || enc;
27243 // StringDecoder provides an interface for efficiently splitting a series of
27244 // buffers into a series of JS strings without breaking apart multi-byte
27246 exports.StringDecoder = StringDecoder;
27247 function StringDecoder(encoding) {
27248 this.encoding = normalizeEncoding(encoding);
27250 switch (this.encoding) {
27252 this.text = utf16Text;
27253 this.end = utf16End;
27257 this.fillLast = utf8FillLast;
27261 this.text = base64Text;
27262 this.end = base64End;
27266 this.write = simpleWrite;
27267 this.end = simpleEnd;
27271 this.lastTotal = 0;
27272 this.lastChar = Buffer.allocUnsafe(nb);
27275 StringDecoder.prototype.write = function (buf) {
27276 if (buf.length === 0) return '';
27279 if (this.lastNeed) {
27280 r = this.fillLast(buf);
27281 if (r === undefined) return '';
27287 if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
27291 StringDecoder.prototype.end = utf8End;
27293 // Returns only complete characters in a Buffer
27294 StringDecoder.prototype.text = utf8Text;
27296 // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
27297 StringDecoder.prototype.fillLast = function (buf) {
27298 if (this.lastNeed <= buf.length) {
27299 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
27300 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
27302 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
27303 this.lastNeed -= buf.length;
27306 // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
27307 // continuation byte. If an invalid byte is detected, -2 is returned.
27308 function utf8CheckByte(byte) {
27309 if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
27310 return byte >> 6 === 0x02 ? -1 : -2;
27313 // Checks at most 3 bytes at the end of a Buffer in order to detect an
27314 // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
27315 // needed to complete the UTF-8 character (if applicable) are returned.
27316 function utf8CheckIncomplete(self, buf, i) {
27317 var j = buf.length - 1;
27318 if (j < i) return 0;
27319 var nb = utf8CheckByte(buf[j]);
27321 if (nb > 0) self.lastNeed = nb - 1;
27324 if (--j < i || nb === -2) return 0;
27325 nb = utf8CheckByte(buf[j]);
27327 if (nb > 0) self.lastNeed = nb - 2;
27330 if (--j < i || nb === -2) return 0;
27331 nb = utf8CheckByte(buf[j]);
27334 if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
27341 // Validates as many continuation bytes for a multi-byte UTF-8 character as
27342 // needed or are available. If we see a non-continuation byte where we expect
27343 // one, we "replace" the validated continuation bytes we've seen so far with
27344 // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
27345 // behavior. The continuation byte check is included three times in the case
27346 // where all of the continuation bytes for a character exist in the same buffer.
27347 // It is also done this way as a slight performance increase instead of using a
27349 function utf8CheckExtraBytes(self, buf, p) {
27350 if ((buf[0] & 0xC0) !== 0x80) {
27354 if (self.lastNeed > 1 && buf.length > 1) {
27355 if ((buf[1] & 0xC0) !== 0x80) {
27359 if (self.lastNeed > 2 && buf.length > 2) {
27360 if ((buf[2] & 0xC0) !== 0x80) {
27368 // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
27369 function utf8FillLast(buf) {
27370 var p = this.lastTotal - this.lastNeed;
27371 var r = utf8CheckExtraBytes(this, buf, p);
27372 if (r !== undefined) return r;
27373 if (this.lastNeed <= buf.length) {
27374 buf.copy(this.lastChar, p, 0, this.lastNeed);
27375 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
27377 buf.copy(this.lastChar, p, 0, buf.length);
27378 this.lastNeed -= buf.length;
27381 // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
27382 // partial character, the character's bytes are buffered until the required
27383 // number of bytes are available.
27384 function utf8Text(buf, i) {
27385 var total = utf8CheckIncomplete(this, buf, i);
27386 if (!this.lastNeed) return buf.toString('utf8', i);
27387 this.lastTotal = total;
27388 var end = buf.length - (total - this.lastNeed);
27389 buf.copy(this.lastChar, 0, end);
27390 return buf.toString('utf8', i, end);
27393 // For UTF-8, a replacement character is added when ending on a partial
27395 function utf8End(buf) {
27396 var r = buf && buf.length ? this.write(buf) : '';
27397 if (this.lastNeed) return r + '\ufffd';
27401 // UTF-16LE typically needs two bytes per character, but even if we have an even
27402 // number of bytes available, we need to check if we end on a leading/high
27403 // surrogate. In that case, we need to wait for the next two bytes in order to
27404 // decode the last character properly.
27405 function utf16Text(buf, i) {
27406 if ((buf.length - i) % 2 === 0) {
27407 var r = buf.toString('utf16le', i);
27409 var c = r.charCodeAt(r.length - 1);
27410 if (c >= 0xD800 && c <= 0xDBFF) {
27412 this.lastTotal = 4;
27413 this.lastChar[0] = buf[buf.length - 2];
27414 this.lastChar[1] = buf[buf.length - 1];
27415 return r.slice(0, -1);
27421 this.lastTotal = 2;
27422 this.lastChar[0] = buf[buf.length - 1];
27423 return buf.toString('utf16le', i, buf.length - 1);
27426 // For UTF-16LE we do not explicitly append special replacement characters if we
27427 // end on a partial character, we simply let v8 handle that.
27428 function utf16End(buf) {
27429 var r = buf && buf.length ? this.write(buf) : '';
27430 if (this.lastNeed) {
27431 var end = this.lastTotal - this.lastNeed;
27432 return r + this.lastChar.toString('utf16le', 0, end);
27437 function base64Text(buf, i) {
27438 var n = (buf.length - i) % 3;
27439 if (n === 0) return buf.toString('base64', i);
27440 this.lastNeed = 3 - n;
27441 this.lastTotal = 3;
27443 this.lastChar[0] = buf[buf.length - 1];
27445 this.lastChar[0] = buf[buf.length - 2];
27446 this.lastChar[1] = buf[buf.length - 1];
27448 return buf.toString('base64', i, buf.length - n);
27451 function base64End(buf) {
27452 var r = buf && buf.length ? this.write(buf) : '';
27453 if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
27457 // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
27458 function simpleWrite(buf) {
27459 return buf.toString(this.encoding);
27462 function simpleEnd(buf) {
27463 return buf && buf.length ? this.write(buf) : '';
27468 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27471 // Copyright Joyent, Inc. and other Node contributors.
27473 // Permission is hereby granted, free of charge, to any person obtaining a
27474 // copy of this software and associated documentation files (the
27475 // "Software"), to deal in the Software without restriction, including
27476 // without limitation the rights to use, copy, modify, merge, publish,
27477 // distribute, sublicense, and/or sell copies of the Software, and to permit
27478 // persons to whom the Software is furnished to do so, subject to the
27479 // following conditions:
27481 // The above copyright notice and this permission notice shall be included
27482 // in all copies or substantial portions of the Software.
27484 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27485 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27486 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27487 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27488 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27489 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
27490 // USE OR OTHER DEALINGS IN THE SOFTWARE.
27492 // a transform stream is a readable/writable stream where you do
27493 // something with the data. Sometimes it's called a "filter",
27494 // but that's not a great name for it, since that implies a thing where
27495 // some bits pass through, and others are simply ignored. (That would
27496 // be a valid example of a transform, of course.)
27498 // While the output is causally related to the input, it's not a
27499 // necessarily symmetric or synchronous transformation. For example,
27500 // a zlib stream might take multiple plain-text writes(), and then
27501 // emit a single compressed chunk some time in the future.
27503 // Here's how this works:
27505 // The Transform stream has all the aspects of the readable and writable
27506 // stream classes. When you write(chunk), that calls _write(chunk,cb)
27507 // internally, and returns false if there's a lot of pending writes
27508 // buffered up. When you call read(), that calls _read(n) until
27509 // there's enough pending readable data buffered up.
27511 // In a transform stream, the written data is placed in a buffer. When
27512 // _read(n) is called, it transforms the queued up data, calling the
27513 // buffered _write cb's as it consumes chunks. If consuming a single
27514 // written chunk would result in multiple output chunks, then the first
27515 // outputted bit calls the readcb, and subsequent chunks just go into
27516 // the read buffer, and will cause it to emit 'readable' if necessary.
27518 // This way, back-pressure is actually determined by the reading side,
27519 // since _read has to be called to start processing a new chunk. However,
27520 // a pathological inflate type of transform can cause excessive buffering
27521 // here. For example, imagine a stream where every byte of input is
27522 // interpreted as an integer from 0-255, and then results in that many
27523 // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
27524 // 1kb of data being output. In this case, you could write a very small
27525 // amount of input, and end up with a very large amount of output. In
27526 // such a pathological inflating mechanism, there'd be no way to tell
27527 // the system to stop doing the transform. A single 4MB write could
27528 // cause the system to run out of memory.
27530 // However, even in such a pathological case, only a single written chunk
27531 // would be consumed, and then the rest would wait (un-transformed) until
27532 // the results of the previous transformed chunk were consumed.
27536 module.exports = Transform;
27538 var Duplex = __webpack_require__(176);
27541 var util = Object.create(__webpack_require__(173));
27542 util.inherits = __webpack_require__(66);
27545 util.inherits(Transform, Duplex);
27547 function afterTransform(er, data) {
27548 var ts = this._transformState;
27549 ts.transforming = false;
27551 var cb = ts.writecb;
27554 return this.emit('error', new Error('write callback called multiple times'));
27557 ts.writechunk = null;
27560 if (data != null) // single equals check for both `null` and `undefined`
27565 var rs = this._readableState;
27566 rs.reading = false;
27567 if (rs.needReadable || rs.length < rs.highWaterMark) {
27568 this._read(rs.highWaterMark);
27572 function Transform(options) {
27573 if (!(this instanceof Transform)) return new Transform(options);
27575 Duplex.call(this, options);
27577 this._transformState = {
27578 afterTransform: afterTransform.bind(this),
27579 needTransform: false,
27580 transforming: false,
27583 writeencoding: null
27586 // start out asking for a readable event once data is transformed.
27587 this._readableState.needReadable = true;
27589 // we have implemented the _read method, and done the other things
27590 // that Readable wants before the first _read call, so unset the
27591 // sync guard flag.
27592 this._readableState.sync = false;
27595 if (typeof options.transform === 'function') this._transform = options.transform;
27597 if (typeof options.flush === 'function') this._flush = options.flush;
27600 // When the writable side finishes, then flush out anything remaining.
27601 this.on('prefinish', prefinish);
27604 function prefinish() {
27607 if (typeof this._flush === 'function') {
27608 this._flush(function (er, data) {
27609 done(_this, er, data);
27612 done(this, null, null);
27616 Transform.prototype.push = function (chunk, encoding) {
27617 this._transformState.needTransform = false;
27618 return Duplex.prototype.push.call(this, chunk, encoding);
27621 // This is the part where you do stuff!
27622 // override this function in implementation classes.
27623 // 'chunk' is an input chunk.
27625 // Call `push(newChunk)` to pass along transformed output
27626 // to the readable side. You may call 'push' zero or more times.
27628 // Call `cb(err)` when you are done with this chunk. If you pass
27629 // an error, then that'll put the hurt on the whole operation. If you
27630 // never call cb(), then you'll never get another chunk.
27631 Transform.prototype._transform = function (chunk, encoding, cb) {
27632 throw new Error('_transform() is not implemented');
27635 Transform.prototype._write = function (chunk, encoding, cb) {
27636 var ts = this._transformState;
27638 ts.writechunk = chunk;
27639 ts.writeencoding = encoding;
27640 if (!ts.transforming) {
27641 var rs = this._readableState;
27642 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
27646 // Doesn't matter what the args are here.
27647 // _transform does all the work.
27648 // That we got here means that the readable side wants more data.
27649 Transform.prototype._read = function (n) {
27650 var ts = this._transformState;
27652 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
27653 ts.transforming = true;
27654 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
27656 // mark that we need a transform, so that any data that comes in
27657 // will get processed, now that we've asked for it.
27658 ts.needTransform = true;
27662 Transform.prototype._destroy = function (err, cb) {
27665 Duplex.prototype._destroy.call(this, err, function (err2) {
27667 _this2.emit('close');
27671 function done(stream, er, data) {
27672 if (er) return stream.emit('error', er);
27674 if (data != null) // single equals check for both `null` and `undefined`
27677 // if there's nothing in the write buffer, then that means
27678 // that nothing more will ever be provided
27679 if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
27681 if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
27683 return stream.push(null);
27688 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27691 // Copyright Joyent, Inc. and other Node contributors.
27693 // Permission is hereby granted, free of charge, to any person obtaining a
27694 // copy of this software and associated documentation files (the
27695 // "Software"), to deal in the Software without restriction, including
27696 // without limitation the rights to use, copy, modify, merge, publish,
27697 // distribute, sublicense, and/or sell copies of the Software, and to permit
27698 // persons to whom the Software is furnished to do so, subject to the
27699 // following conditions:
27701 // The above copyright notice and this permission notice shall be included
27702 // in all copies or substantial portions of the Software.
27704 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27705 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27706 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27707 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27708 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27709 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
27710 // USE OR OTHER DEALINGS IN THE SOFTWARE.
27712 // a passthrough stream.
27713 // basically just the most minimal sort of Transform stream.
27714 // Every written chunk gets output as-is.
27718 module.exports = PassThrough;
27720 var Transform = __webpack_require__(180);
27723 var util = Object.create(__webpack_require__(173));
27724 util.inherits = __webpack_require__(66);
27727 util.inherits(PassThrough, Transform);
27729 function PassThrough(options) {
27730 if (!(this instanceof PassThrough)) return new PassThrough(options);
27732 Transform.call(this, options);
27735 PassThrough.prototype._transform = function (chunk, encoding, cb) {
27741 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27743 var Stream = __webpack_require__(44);
27744 var util = __webpack_require__(50);
27746 // Backwards compatibility for node versions < 8
27747 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
27748 Stream = __webpack_require__(167);
27750 function NoopStream() {
27751 if (!(this instanceof NoopStream)) {
27752 return new NoopStream();
27754 Stream.Transform.call(this);
27757 util.inherits(NoopStream,Stream.Transform);
27759 NoopStream.prototype._transform = function(d,e,cb) { cb() ;};
27761 module.exports = NoopStream;
27765 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27767 var Promise = __webpack_require__(128);
27768 var Stream = __webpack_require__(44);
27769 var Buffer = __webpack_require__(165);
27771 // Backwards compatibility for node versions < 8
27772 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
27773 Stream = __webpack_require__(167);
27775 module.exports = function(entry) {
27776 return new Promise(function(resolve,reject) {
27778 var bufferStream = Stream.Transform()
27779 .on('finish',function() {
27780 resolve(Buffer.concat(chunks));
27782 .on('error',reject);
27784 bufferStream._transform = function(d,e,cb) {
27788 entry.on('error',reject)
27789 .pipe(bufferStream);
27796 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27798 var binary = __webpack_require__(123);
27800 module.exports = function(extraField, vars) {
27802 // Find the ZIP64 header, if present.
27803 while(!extra && extraField && extraField.length) {
27804 var candidateExtra = binary.parse(extraField)
27805 .word16lu('signature')
27806 .word16lu('partsize')
27807 .word64lu('uncompressedSize')
27808 .word64lu('compressedSize')
27809 .word64lu('offset')
27810 .word64lu('disknum')
27813 if(candidateExtra.signature === 0x0001) {
27814 extra = candidateExtra;
27816 // Advance the buffer to the next part.
27817 // The total size of this part is the 4 byte header + partsize.
27818 extraField = extraField.slice(candidateExtra.partsize + 4);
27822 extra = extra || {};
27824 if (vars.compressedSize === 0xffffffff)
27825 vars.compressedSize = extra.compressedSize;
27827 if (vars.uncompressedSize === 0xffffffff)
27828 vars.uncompressedSize= extra.uncompressedSize;
27830 if (vars.offsetToLocalFileHeader === 0xffffffff)
27831 vars.offsetToLocalFileHeader= extra.offset;
27839 /***/ ((module) => {
27841 // Dates in zip file entries are stored as DosDateTime
27842 // Spec is here: https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-dosdatetimetofiletime
27844 module.exports = function parseDateTime(date, time) {
27845 const day = date & 0x1F;
27846 const month = date >> 5 & 0x0F;
27847 const year = (date >> 9 & 0x7F) + 1980;
27848 const seconds = time ? (time & 0x1F) * 2 : 0;
27849 const minutes = time ? (time >> 5) & 0x3F : 0;
27850 const hours = time ? (time >> 11): 0;
27852 return new Date(Date.UTC(year, month-1, day, hours, minutes, seconds));
27857 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27859 var Stream = __webpack_require__(44);
27860 var Parse = __webpack_require__(122);
27861 var duplexer2 = __webpack_require__(187);
27862 var BufferStream = __webpack_require__(183);
27864 // Backwards compatibility for node versions < 8
27865 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
27866 Stream = __webpack_require__(167);
27868 function parseOne(match,opts) {
27869 var inStream = Stream.PassThrough({objectMode:true});
27870 var outStream = Stream.PassThrough();
27871 var transform = Stream.Transform({objectMode:true});
27872 var re = match instanceof RegExp ? match : (match && new RegExp(match));
27875 transform._transform = function(entry,e,cb) {
27876 if (found || (re && !re.exec(entry.path))) {
27881 out.emit('entry',entry);
27882 entry.on('error',function(e) {
27883 outStream.emit('error',e);
27885 entry.pipe(outStream)
27886 .on('error',function(err) {
27889 .on('finish',function(d) {
27895 inStream.pipe(Parse(opts))
27896 .on('error',function(err) {
27897 outStream.emit('error',err);
27900 .on('error',Object) // Silence error as its already addressed in transform
27901 .on('finish',function() {
27903 outStream.emit('error',new Error('PATTERN_NOT_FOUND'));
27908 var out = duplexer2(inStream,outStream);
27909 out.buffer = function() {
27910 return BufferStream(outStream);
27916 module.exports = parseOne;
27921 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27926 var stream = __webpack_require__(167);
27928 function DuplexWrapper(options, writable, readable) {
27929 if (typeof readable === "undefined") {
27930 readable = writable;
27931 writable = options;
27935 stream.Duplex.call(this, options);
27937 if (typeof readable.read !== "function") {
27938 readable = (new stream.Readable(options)).wrap(readable);
27941 this._writable = writable;
27942 this._readable = readable;
27943 this._waiting = false;
27947 writable.once("finish", function() {
27951 this.once("finish", function() {
27955 readable.on("readable", function() {
27956 if (self._waiting) {
27957 self._waiting = false;
27962 readable.once("end", function() {
27966 if (!options || typeof options.bubbleErrors === "undefined" || options.bubbleErrors) {
27967 writable.on("error", function(err) {
27968 self.emit("error", err);
27971 readable.on("error", function(err) {
27972 self.emit("error", err);
27977 DuplexWrapper.prototype = Object.create(stream.Duplex.prototype, {constructor: {value: DuplexWrapper}});
27979 DuplexWrapper.prototype._write = function _write(input, encoding, done) {
27980 this._writable.write(input, encoding, done);
27983 DuplexWrapper.prototype._read = function _read() {
27986 while ((buf = this._readable.read()) !== null) {
27991 this._waiting = true;
27995 module.exports = function duplex2(options, writable, readable) {
27996 return new DuplexWrapper(options, writable, readable);
27999 module.exports.DuplexWrapper = DuplexWrapper;
28004 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
28006 module.exports = Extract;
28008 var Parse = __webpack_require__(122);
28009 var Writer = __webpack_require__(189).Writer;
28010 var path = __webpack_require__(2);
28011 var stream = __webpack_require__(44);
28012 var duplexer2 = __webpack_require__(187);
28013 var Promise = __webpack_require__(128);
28015 function Extract (opts) {
28016 // make sure path is normalized before using it
28017 opts.path = path.resolve(path.normalize(opts.path));
28019 var parser = new Parse(opts);
28021 var outStream = new stream.Writable({objectMode: true});
28022 outStream._write = function(entry, encoding, cb) {
28024 if (entry.type == 'Directory') return cb();
28026 // to avoid zip slip (writing outside of the destination), we resolve
28027 // the target path, and make sure it's nested in the intended
28028 // destination, or not extract it otherwise.
28029 var extractPath = path.join(opts.path, entry.path);
28030 if (extractPath.indexOf(opts.path) != 0) {
28034 const writer = opts.getWriter ? opts.getWriter({path: extractPath}) : Writer({ path: extractPath });
28041 var extract = duplexer2(parser,outStream);
28042 parser.once('crx-header', function(crxHeader) {
28043 extract.crxHeader = crxHeader;
28048 .on('finish',function() {
28049 extract.emit('close');
28052 extract.promise = function() {
28053 return new Promise(function(resolve, reject) {
28054 extract.on('close', resolve);
28055 extract.on('error',reject);
28065 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
28067 exports.Abstract = __webpack_require__(190)
28068 exports.Reader = __webpack_require__(191)
28069 exports.Writer = __webpack_require__(203)
28072 Reader: __webpack_require__(200),
28073 Writer: __webpack_require__(209)
28077 Reader: __webpack_require__(199),
28078 Writer: __webpack_require__(206)
28082 Reader: __webpack_require__(198),
28083 Writer: __webpack_require__(208)
28087 Reader: __webpack_require__(202),
28088 Writer: __webpack_require__(210)
28091 exports.Reader.Dir = exports.DirReader = exports.Dir.Reader
28092 exports.Reader.File = exports.FileReader = exports.File.Reader
28093 exports.Reader.Link = exports.LinkReader = exports.Link.Reader
28094 exports.Reader.Proxy = exports.ProxyReader = exports.Proxy.Reader
28096 exports.Writer.Dir = exports.DirWriter = exports.Dir.Writer
28097 exports.Writer.File = exports.FileWriter = exports.File.Writer
28098 exports.Writer.Link = exports.LinkWriter = exports.Link.Writer
28099 exports.Writer.Proxy = exports.ProxyWriter = exports.Proxy.Writer
28101 exports.collect = __webpack_require__(207)
28106 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
28108 // the parent class for all fstreams.
28110 module.exports = Abstract
28112 var Stream = __webpack_require__(44).Stream
28113 var inherits = __webpack_require__(66)
28115 function Abstract () {
28119 inherits(Abstract, Stream)
28121 Abstract.prototype.on = function (ev, fn) {
28122 if (ev === 'ready' && this.ready) {
28123 process.nextTick(fn.bind(this))
28125 Stream.prototype.on.call(this, ev, fn)
28130 Abstract.prototype.abort = function () {
28131 this._aborted = true
28135 Abstract.prototype.destroy = function () {}
28137 Abstract.prototype.warn = function (msg, code) {
28139 var er = decorate(msg, code, self)
28140 if (!self.listeners('warn')) {
28141 console.error('%s %s\n' +
28144 'fstream_type = %s\n' +
28145 'fstream_path = %s\n' +
28146 'fstream_unc_path = %s\n' +
28147 'fstream_class = %s\n' +
28148 'fstream_stack =\n%s\n',
28155 er.fstream_unc_path,
28157 er.fstream_stack.join('\n'))
28159 self.emit('warn', er)
28163 Abstract.prototype.info = function (msg, code) {
28164 this.emit('info', msg, code)
28167 Abstract.prototype.error = function (msg, code, th) {
28168 var er = decorate(msg, code, this)
28170 else this.emit('error', er)
28173 function decorate (er, code, self) {
28174 if (!(er instanceof Error)) er = new Error(er)
28175 er.code = er.code || code
28176 er.path = er.path || self.path
28177 er.fstream_type = er.fstream_type || self.type
28178 er.fstream_path = er.fstream_path || self.path
28179 if (self._path !== self.path) {
28180 er.fstream_unc_path = er.fstream_unc_path || self._path
28182 if (self.linkpath) {
28183 er.fstream_linkpath = er.fstream_linkpath || self.linkpath
28185 er.fstream_class = er.fstream_class || self.constructor.name
28186 er.fstream_stack = er.fstream_stack ||
28187 new Error().stack.split(/\n/).slice(3).map(function (s) {
28188 return s.replace(/^ {4}at /, '')
28197 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
28199 module.exports = Reader
28201 var fs = __webpack_require__(192)
28202 var Stream = __webpack_require__(44).Stream
28203 var inherits = __webpack_require__(66)
28204 var path = __webpack_require__(2)
28205 var getType = __webpack_require__(197)
28206 var hardLinks = Reader.hardLinks = {}
28207 var Abstract = __webpack_require__(190)
28209 // Must do this *before* loading the child classes
28210 inherits(Reader, Abstract)
28212 var LinkReader = __webpack_require__(198)
28214 function Reader (props, currentStat) {
28216 if (!(self instanceof Reader)) return new Reader(props, currentStat)
28218 if (typeof props === 'string') {
28219 props = { path: props }
28223 // call fstream.Reader(dir) to get a DirReader object, etc.
28224 // Note that, unlike in the Writer case, ProxyReader is going
28225 // to be the *normal* state of affairs, since we rarely know
28226 // the type of a file prior to reading it.
28231 if (props.type && typeof props.type === 'function') {
28235 type = getType(props)
28239 if (currentStat && !type) {
28240 type = getType(currentStat)
28247 ClassType = __webpack_require__(199)
28251 // XXX hard links are just files.
28252 // However, it would be good to keep track of files' dev+inode
28253 // and nlink values, and create a HardLinkReader that emits
28254 // a linkpath value of the original copy, so that the tar
28255 // writer can preserve them.
28256 // ClassType = HardLinkReader
28260 ClassType = __webpack_require__(200)
28263 case 'SymbolicLink':
28264 ClassType = LinkReader
28268 ClassType = __webpack_require__(201)
28272 ClassType = __webpack_require__(202)
28276 if (!(self instanceof ClassType)) {
28277 return new ClassType(props)
28280 Abstract.call(self)
28283 self.error('Must provide a path', null, true)
28286 self.readable = true
28287 self.writable = false
28291 self.depth = props.depth = props.depth || 0
28292 self.parent = props.parent || null
28293 self.root = props.root || (props.parent && props.parent.root) || self
28295 self._path = self.path = path.resolve(props.path)
28296 if (process.platform === 'win32') {
28297 self.path = self._path = self.path.replace(/\?/g, '_')
28298 if (self._path.length >= 260) {
28299 // how DOES one create files on the moon?
28300 // if the path has spaces in it, then UNC will fail.
28301 self._swallowErrors = true
28302 // if (self._path.indexOf(" ") === -1) {
28303 self._path = '\\\\?\\' + self.path.replace(/\//g, '\\')
28307 self.basename = props.basename = path.basename(self.path)
28308 self.dirname = props.dirname = path.dirname(self.path)
28310 // these have served their purpose, and are now just noisy clutter
28311 props.parent = props.root = null
28313 // console.error("\n\n\n%s setting size to", props.path, props.size)
28314 self.size = props.size
28315 self.filter = typeof props.filter === 'function' ? props.filter : null
28316 if (props.sort === 'alpha') props.sort = alphasort
28318 // start the ball rolling.
28319 // this will stat the thing, and then call self._read()
28320 // to start reading whatever it is.
28321 // console.error("calling stat", props.path, currentStat)
28322 self._stat(currentStat)
28325 function alphasort (a, b) {
28327 : a.toLowerCase() > b.toLowerCase() ? 1
28328 : a.toLowerCase() < b.toLowerCase() ? -1
28333 Reader.prototype._stat = function (currentStat) {
28335 var props = self.props
28336 var stat = props.follow ? 'stat' : 'lstat'
28337 // console.error("Reader._stat", self._path, currentStat)
28338 if (currentStat) process.nextTick(statCb.bind(null, null, currentStat))
28339 else fs[stat](self._path, statCb)
28341 function statCb (er, props_) {
28342 // console.error("Reader._stat, statCb", self._path, props_, props_.nlink)
28343 if (er) return self.error(er)
28345 Object.keys(props_).forEach(function (k) {
28346 props[k] = props_[k]
28349 // if it's not the expected size, then abort here.
28350 if (undefined !== self.size && props.size !== self.size) {
28351 return self.error('incorrect size')
28353 self.size = props.size
28355 var type = getType(props)
28356 var handleHardlinks = props.hardlinks !== false
28358 // special little thing for handling hardlinks.
28359 if (handleHardlinks && type !== 'Directory' && props.nlink && props.nlink > 1) {
28360 var k = props.dev + ':' + props.ino
28361 // console.error("Reader has nlink", self._path, k)
28362 if (hardLinks[k] === self._path || !hardLinks[k]) {
28363 hardLinks[k] = self._path
28365 // switch into hardlink mode.
28366 type = self.type = self.props.type = 'Link'
28367 self.Link = self.props.Link = true
28368 self.linkpath = self.props.linkpath = hardLinks[k]
28369 // console.error("Hardlink detected, switching mode", self._path, self.linkpath)
28370 // Setting __proto__ would arguably be the "correct"
28371 // approach here, but that just seems too wrong.
28372 self._stat = self._read = LinkReader.prototype._read
28376 if (self.type && self.type !== type) {
28377 self.error('Unexpected type: ' + type)
28380 // if the filter doesn't pass, then just skip over this one.
28381 // still have to emit end so that dir-walking can move on.
28383 var who = self._proxy || self
28384 // special handling for ProxyReaders
28385 if (!self.filter.call(who, who, props)) {
28386 if (!self._disowned) {
28395 // last chance to abort or disown before the flow starts!
28396 var events = ['_stat', 'stat', 'ready']
28399 if (self._aborted) {
28405 if (self._paused && self.type !== 'Directory') {
28406 self.once('resume', go)
28410 var ev = events[e++]
28412 return self._read()
28414 self.emit(ev, props)
28420 Reader.prototype.pipe = function (dest) {
28422 if (typeof dest.add === 'function') {
28423 // piping to a multi-compatible, and we've got directory entries.
28424 self.on('entry', function (entry) {
28425 var ret = dest.add(entry)
28426 if (ret === false) {
28432 // console.error("R Pipe apply Stream Pipe")
28433 return Stream.prototype.pipe.apply(this, arguments)
28436 Reader.prototype.pause = function (who) {
28437 this._paused = true
28439 this.emit('pause', who)
28440 if (this._stream) this._stream.pause(who)
28443 Reader.prototype.resume = function (who) {
28444 this._paused = false
28446 this.emit('resume', who)
28447 if (this._stream) this._stream.resume(who)
28451 Reader.prototype._read = function () {
28452 this.error('Cannot read unknown type: ' + this.type)
28458 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
28460 var fs = __webpack_require__(42)
28461 var polyfills = __webpack_require__(193)
28462 var legacy = __webpack_require__(195)
28463 var clone = __webpack_require__(196)
28465 var util = __webpack_require__(50)
28467 /* istanbul ignore next - node 0.x polyfill */
28471 /* istanbul ignore else - node 0.x polyfill */
28472 if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
28473 gracefulQueue = Symbol.for('graceful-fs.queue')
28474 // This is used in testing by future versions
28475 previousSymbol = Symbol.for('graceful-fs.previous')
28477 gracefulQueue = '___graceful-fs.queue'
28478 previousSymbol = '___graceful-fs.previous'
28481 function noop () {}
28483 function publishQueue(context, queue) {
28484 Object.defineProperty(context, gracefulQueue, {
28493 debug = util.debuglog('gfs4')
28494 else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
28495 debug = function() {
28496 var m = util.format.apply(util, arguments)
28497 m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
28501 // Once time initialization
28502 if (!fs[gracefulQueue]) {
28503 // This queue can be shared by multiple loaded instances
28504 var queue = global[gracefulQueue] || []
28505 publishQueue(fs, queue)
28507 // Patch fs.close/closeSync to shared queue version, because we need
28508 // to retry() whenever a close happens *anywhere* in the program.
28509 // This is essential when multiple graceful-fs instances are
28510 // in play at the same time.
28511 fs.close = (function (fs$close) {
28512 function close (fd, cb) {
28513 return fs$close.call(fs, fd, function (err) {
28514 // This function uses the graceful-fs shared queue
28519 if (typeof cb === 'function')
28520 cb.apply(this, arguments)
28524 Object.defineProperty(close, previousSymbol, {
28530 fs.closeSync = (function (fs$closeSync) {
28531 function closeSync (fd) {
28532 // This function uses the graceful-fs shared queue
28533 fs$closeSync.apply(fs, arguments)
28537 Object.defineProperty(closeSync, previousSymbol, {
28538 value: fs$closeSync
28543 if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
28544 process.on('exit', function() {
28545 debug(fs[gracefulQueue])
28546 __webpack_require__(58).equal(fs[gracefulQueue].length, 0)
28551 if (!global[gracefulQueue]) {
28552 publishQueue(global, fs[gracefulQueue]);
28555 module.exports = patch(clone(fs))
28556 if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
28557 module.exports = patch(fs)
28558 fs.__patched = true;
28561 function patch (fs) {
28562 // Everything that references the open() function needs to be in here
28564 fs.gracefulify = patch
28566 fs.createReadStream = createReadStream
28567 fs.createWriteStream = createWriteStream
28568 var fs$readFile = fs.readFile
28569 fs.readFile = readFile
28570 function readFile (path, options, cb) {
28571 if (typeof options === 'function')
28572 cb = options, options = null
28574 return go$readFile(path, options, cb)
28576 function go$readFile (path, options, cb) {
28577 return fs$readFile(path, options, function (err) {
28578 if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28579 enqueue([go$readFile, [path, options, cb]])
28581 if (typeof cb === 'function')
28582 cb.apply(this, arguments)
28589 var fs$writeFile = fs.writeFile
28590 fs.writeFile = writeFile
28591 function writeFile (path, data, options, cb) {
28592 if (typeof options === 'function')
28593 cb = options, options = null
28595 return go$writeFile(path, data, options, cb)
28597 function go$writeFile (path, data, options, cb) {
28598 return fs$writeFile(path, data, options, function (err) {
28599 if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28600 enqueue([go$writeFile, [path, data, options, cb]])
28602 if (typeof cb === 'function')
28603 cb.apply(this, arguments)
28610 var fs$appendFile = fs.appendFile
28612 fs.appendFile = appendFile
28613 function appendFile (path, data, options, cb) {
28614 if (typeof options === 'function')
28615 cb = options, options = null
28617 return go$appendFile(path, data, options, cb)
28619 function go$appendFile (path, data, options, cb) {
28620 return fs$appendFile(path, data, options, function (err) {
28621 if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28622 enqueue([go$appendFile, [path, data, options, cb]])
28624 if (typeof cb === 'function')
28625 cb.apply(this, arguments)
28632 var fs$readdir = fs.readdir
28633 fs.readdir = readdir
28634 function readdir (path, options, cb) {
28636 if (typeof options !== 'function') {
28641 args.push(go$readdir$cb)
28643 return go$readdir(args)
28645 function go$readdir$cb (err, files) {
28646 if (files && files.sort)
28649 if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28650 enqueue([go$readdir, [args]])
28653 if (typeof cb === 'function')
28654 cb.apply(this, arguments)
28660 function go$readdir (args) {
28661 return fs$readdir.apply(fs, args)
28664 if (process.version.substr(0, 4) === 'v0.8') {
28665 var legStreams = legacy(fs)
28666 ReadStream = legStreams.ReadStream
28667 WriteStream = legStreams.WriteStream
28670 var fs$ReadStream = fs.ReadStream
28671 if (fs$ReadStream) {
28672 ReadStream.prototype = Object.create(fs$ReadStream.prototype)
28673 ReadStream.prototype.open = ReadStream$open
28676 var fs$WriteStream = fs.WriteStream
28677 if (fs$WriteStream) {
28678 WriteStream.prototype = Object.create(fs$WriteStream.prototype)
28679 WriteStream.prototype.open = WriteStream$open
28682 Object.defineProperty(fs, 'ReadStream', {
28686 set: function (val) {
28692 Object.defineProperty(fs, 'WriteStream', {
28696 set: function (val) {
28704 var FileReadStream = ReadStream
28705 Object.defineProperty(fs, 'FileReadStream', {
28707 return FileReadStream
28709 set: function (val) {
28710 FileReadStream = val
28715 var FileWriteStream = WriteStream
28716 Object.defineProperty(fs, 'FileWriteStream', {
28718 return FileWriteStream
28720 set: function (val) {
28721 FileWriteStream = val
28727 function ReadStream (path, options) {
28728 if (this instanceof ReadStream)
28729 return fs$ReadStream.apply(this, arguments), this
28731 return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
28734 function ReadStream$open () {
28736 open(that.path, that.flags, that.mode, function (err, fd) {
28738 if (that.autoClose)
28741 that.emit('error', err)
28744 that.emit('open', fd)
28750 function WriteStream (path, options) {
28751 if (this instanceof WriteStream)
28752 return fs$WriteStream.apply(this, arguments), this
28754 return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
28757 function WriteStream$open () {
28759 open(that.path, that.flags, that.mode, function (err, fd) {
28762 that.emit('error', err)
28765 that.emit('open', fd)
28770 function createReadStream (path, options) {
28771 return new fs.ReadStream(path, options)
28774 function createWriteStream (path, options) {
28775 return new fs.WriteStream(path, options)
28778 var fs$open = fs.open
28780 function open (path, flags, mode, cb) {
28781 if (typeof mode === 'function')
28782 cb = mode, mode = null
28784 return go$open(path, flags, mode, cb)
28786 function go$open (path, flags, mode, cb) {
28787 return fs$open(path, flags, mode, function (err, fd) {
28788 if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
28789 enqueue([go$open, [path, flags, mode, cb]])
28791 if (typeof cb === 'function')
28792 cb.apply(this, arguments)
28802 function enqueue (elem) {
28803 debug('ENQUEUE', elem[0].name, elem[1])
28804 fs[gracefulQueue].push(elem)
28807 function retry () {
28808 var elem = fs[gracefulQueue].shift()
28810 debug('RETRY', elem[0].name, elem[1])
28811 elem[0].apply(null, elem[1])
28818 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
28820 var constants = __webpack_require__(194)
28822 var origCwd = process.cwd
28825 var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
28827 process.cwd = function() {
28829 cwd = origCwd.call(process)
28836 var chdir = process.chdir
28837 process.chdir = function(d) {
28839 chdir.call(process, d)
28842 module.exports = patch
28844 function patch (fs) {
28845 // (re-)implement some things that are known busted or missing.
28847 // lchmod, broken prior to 0.6.2
28848 // back-port the fix here.
28849 if (constants.hasOwnProperty('O_SYMLINK') &&
28850 process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
28854 // lutimes implementation, or no-op
28859 // https://github.com/isaacs/node-graceful-fs/issues/4
28860 // Chown should not fail on einval or eperm if non-root.
28861 // It should not fail on enosys ever, as this just indicates
28862 // that a fs doesn't support the intended operation.
28864 fs.chown = chownFix(fs.chown)
28865 fs.fchown = chownFix(fs.fchown)
28866 fs.lchown = chownFix(fs.lchown)
28868 fs.chmod = chmodFix(fs.chmod)
28869 fs.fchmod = chmodFix(fs.fchmod)
28870 fs.lchmod = chmodFix(fs.lchmod)
28872 fs.chownSync = chownFixSync(fs.chownSync)
28873 fs.fchownSync = chownFixSync(fs.fchownSync)
28874 fs.lchownSync = chownFixSync(fs.lchownSync)
28876 fs.chmodSync = chmodFixSync(fs.chmodSync)
28877 fs.fchmodSync = chmodFixSync(fs.fchmodSync)
28878 fs.lchmodSync = chmodFixSync(fs.lchmodSync)
28880 fs.stat = statFix(fs.stat)
28881 fs.fstat = statFix(fs.fstat)
28882 fs.lstat = statFix(fs.lstat)
28884 fs.statSync = statFixSync(fs.statSync)
28885 fs.fstatSync = statFixSync(fs.fstatSync)
28886 fs.lstatSync = statFixSync(fs.lstatSync)
28888 // if lchmod/lchown do not exist, then make them no-ops
28890 fs.lchmod = function (path, mode, cb) {
28891 if (cb) process.nextTick(cb)
28893 fs.lchmodSync = function () {}
28896 fs.lchown = function (path, uid, gid, cb) {
28897 if (cb) process.nextTick(cb)
28899 fs.lchownSync = function () {}
28902 // on Windows, A/V software can lock the directory, causing this
28903 // to fail with an EACCES or EPERM if the directory contains newly
28904 // created files. Try again on failure, for up to 60 seconds.
28906 // Set the timeout this long because some Windows Anti-Virus, such as Parity
28907 // bit9, may lock files for up to a minute, causing npm package install
28908 // failures. Also, take care to yield the scheduler. Windows scheduling gives
28909 // CPU to a busy looping process, which can cause the program causing the lock
28910 // contention to be starved of CPU by node, so the contention doesn't resolve.
28911 if (platform === "win32") {
28912 fs.rename = (function (fs$rename) { return function (from, to, cb) {
28913 var start = Date.now()
28915 fs$rename(from, to, function CB (er) {
28917 && (er.code === "EACCES" || er.code === "EPERM")
28918 && Date.now() - start < 60000) {
28919 setTimeout(function() {
28920 fs.stat(to, function (stater, st) {
28921 if (stater && stater.code === "ENOENT")
28922 fs$rename(from, to, CB);
28936 // if read() returns EAGAIN, then just try it again.
28937 fs.read = (function (fs$read) {
28938 function read (fd, buffer, offset, length, position, callback_) {
28940 if (callback_ && typeof callback_ === 'function') {
28942 callback = function (er, _, __) {
28943 if (er && er.code === 'EAGAIN' && eagCounter < 10) {
28945 return fs$read.call(fs, fd, buffer, offset, length, position, callback)
28947 callback_.apply(this, arguments)
28950 return fs$read.call(fs, fd, buffer, offset, length, position, callback)
28953 // This ensures `util.promisify` works as it does for native `fs.read`.
28954 read.__proto__ = fs$read
28958 fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
28962 return fs$readSync.call(fs, fd, buffer, offset, length, position)
28964 if (er.code === 'EAGAIN' && eagCounter < 10) {
28973 function patchLchmod (fs) {
28974 fs.lchmod = function (path, mode, callback) {
28976 , constants.O_WRONLY | constants.O_SYMLINK
28978 , function (err, fd) {
28980 if (callback) callback(err)
28983 // prefer to return the chmod error, if one occurs,
28984 // but still try to close, and report closing errors if they occur.
28985 fs.fchmod(fd, mode, function (err) {
28986 fs.close(fd, function(err2) {
28987 if (callback) callback(err || err2)
28993 fs.lchmodSync = function (path, mode) {
28994 var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
28996 // prefer to return the chmod error, if one occurs,
28997 // but still try to close, and report closing errors if they occur.
29001 ret = fs.fchmodSync(fd, mode)
29016 function patchLutimes (fs) {
29017 if (constants.hasOwnProperty("O_SYMLINK")) {
29018 fs.lutimes = function (path, at, mt, cb) {
29019 fs.open(path, constants.O_SYMLINK, function (er, fd) {
29024 fs.futimes(fd, at, mt, function (er) {
29025 fs.close(fd, function (er2) {
29026 if (cb) cb(er || er2)
29032 fs.lutimesSync = function (path, at, mt) {
29033 var fd = fs.openSync(path, constants.O_SYMLINK)
29037 ret = fs.futimesSync(fd, at, mt)
29052 fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
29053 fs.lutimesSync = function () {}
29057 function chmodFix (orig) {
29058 if (!orig) return orig
29059 return function (target, mode, cb) {
29060 return orig.call(fs, target, mode, function (er) {
29061 if (chownErOk(er)) er = null
29062 if (cb) cb.apply(this, arguments)
29067 function chmodFixSync (orig) {
29068 if (!orig) return orig
29069 return function (target, mode) {
29071 return orig.call(fs, target, mode)
29073 if (!chownErOk(er)) throw er
29079 function chownFix (orig) {
29080 if (!orig) return orig
29081 return function (target, uid, gid, cb) {
29082 return orig.call(fs, target, uid, gid, function (er) {
29083 if (chownErOk(er)) er = null
29084 if (cb) cb.apply(this, arguments)
29089 function chownFixSync (orig) {
29090 if (!orig) return orig
29091 return function (target, uid, gid) {
29093 return orig.call(fs, target, uid, gid)
29095 if (!chownErOk(er)) throw er
29100 function statFix (orig) {
29101 if (!orig) return orig
29102 // Older versions of Node erroneously returned signed integers for
29104 return function (target, options, cb) {
29105 if (typeof options === 'function') {
29109 function callback (er, stats) {
29111 if (stats.uid < 0) stats.uid += 0x100000000
29112 if (stats.gid < 0) stats.gid += 0x100000000
29114 if (cb) cb.apply(this, arguments)
29116 return options ? orig.call(fs, target, options, callback)
29117 : orig.call(fs, target, callback)
29121 function statFixSync (orig) {
29122 if (!orig) return orig
29123 // Older versions of Node erroneously returned signed integers for
29125 return function (target, options) {
29126 var stats = options ? orig.call(fs, target, options)
29127 : orig.call(fs, target)
29128 if (stats.uid < 0) stats.uid += 0x100000000
29129 if (stats.gid < 0) stats.gid += 0x100000000
29134 // ENOSYS means that the fs doesn't support the op. Just ignore
29135 // that, because it doesn't matter.
29137 // if there's no getuid, or if getuid() is something other
29138 // than 0, and the error is EINVAL or EPERM, then just ignore
29141 // This specific case is a silent failure in cp, install, tar,
29142 // and most other unix tools that manage permissions.
29144 // When running as root, or if other types of errors are
29145 // encountered, then it's strict.
29146 function chownErOk (er) {
29150 if (er.code === "ENOSYS")
29153 var nonroot = !process.getuid || process.getuid() !== 0
29155 if (er.code === "EINVAL" || er.code === "EPERM")
29166 /***/ ((module) => {
29169 module.exports = require("constants");;
29173 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29175 var Stream = __webpack_require__(44).Stream
29177 module.exports = legacy
29179 function legacy (fs) {
29181 ReadStream: ReadStream,
29182 WriteStream: WriteStream
29185 function ReadStream (path, options) {
29186 if (!(this instanceof ReadStream)) return new ReadStream(path, options);
29194 this.readable = true;
29195 this.paused = false;
29198 this.mode = 438; /*=0666*/
29199 this.bufferSize = 64 * 1024;
29201 options = options || {};
29203 // Mixin options into this
29204 var keys = Object.keys(options);
29205 for (var index = 0, length = keys.length; index < length; index++) {
29206 var key = keys[index];
29207 this[key] = options[key];
29210 if (this.encoding) this.setEncoding(this.encoding);
29212 if (this.start !== undefined) {
29213 if ('number' !== typeof this.start) {
29214 throw TypeError('start must be a Number');
29216 if (this.end === undefined) {
29217 this.end = Infinity;
29218 } else if ('number' !== typeof this.end) {
29219 throw TypeError('end must be a Number');
29222 if (this.start > this.end) {
29223 throw new Error('start must be <= end');
29226 this.pos = this.start;
29229 if (this.fd !== null) {
29230 process.nextTick(function() {
29236 fs.open(this.path, this.flags, this.mode, function (err, fd) {
29238 self.emit('error', err);
29239 self.readable = false;
29244 self.emit('open', fd);
29249 function WriteStream (path, options) {
29250 if (!(this instanceof WriteStream)) return new WriteStream(path, options);
29256 this.writable = true;
29259 this.encoding = 'binary';
29260 this.mode = 438; /*=0666*/
29261 this.bytesWritten = 0;
29263 options = options || {};
29265 // Mixin options into this
29266 var keys = Object.keys(options);
29267 for (var index = 0, length = keys.length; index < length; index++) {
29268 var key = keys[index];
29269 this[key] = options[key];
29272 if (this.start !== undefined) {
29273 if ('number' !== typeof this.start) {
29274 throw TypeError('start must be a Number');
29276 if (this.start < 0) {
29277 throw new Error('start must be >= zero');
29280 this.pos = this.start;
29286 if (this.fd === null) {
29287 this._open = fs.open;
29288 this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
29297 /***/ ((module) => {
29302 module.exports = clone
29304 function clone (obj) {
29305 if (obj === null || typeof obj !== 'object')
29308 if (obj instanceof Object)
29309 var copy = { __proto__: obj.__proto__ }
29311 var copy = Object.create(null)
29313 Object.getOwnPropertyNames(obj).forEach(function (key) {
29314 Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
29323 /***/ ((module) => {
29325 module.exports = getType
29327 function getType (st) {
29332 'Link', // special for hardlinks from tarballs
29340 if (st.type && types.indexOf(st.type) !== -1) {
29345 for (var i = 0, l = types.length; i < l; i++) {
29347 var is = st[type] || st['is' + type]
29348 if (typeof is === 'function') is = is.call(st)
29362 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29364 // Basically just a wrapper around an fs.readlink
29366 // XXX: Enhance this to support the Link type, by keeping
29367 // a lookup table of {<dev+inode>:<path>}, so that hardlinks
29368 // can be preserved in tarballs.
29370 module.exports = LinkReader
29372 var fs = __webpack_require__(192)
29373 var inherits = __webpack_require__(66)
29374 var Reader = __webpack_require__(191)
29376 inherits(LinkReader, Reader)
29378 function LinkReader (props) {
29380 if (!(self instanceof LinkReader)) {
29381 throw new Error('LinkReader must be called as constructor.')
29384 if (!((props.type === 'Link' && props.Link) ||
29385 (props.type === 'SymbolicLink' && props.SymbolicLink))) {
29386 throw new Error('Non-link type ' + props.type)
29389 Reader.call(self, props)
29392 // When piping a LinkReader into a LinkWriter, we have to
29393 // already have the linkpath property set, so that has to
29394 // happen *before* the "ready" event, which means we need to
29395 // override the _stat method.
29396 LinkReader.prototype._stat = function (currentStat) {
29398 fs.readlink(self._path, function (er, linkpath) {
29399 if (er) return self.error(er)
29400 self.linkpath = self.props.linkpath = linkpath
29401 self.emit('linkpath', linkpath)
29402 Reader.prototype._stat.call(self, currentStat)
29406 LinkReader.prototype._read = function () {
29408 if (self._paused) return
29409 // basically just a no-op, since we got all the info we need
29410 // from the _stat method
29411 if (!self._ended) {
29421 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29423 // A thing that emits "entry" events with Reader objects
29424 // Pausing it causes it to stop emitting entry events, and also
29425 // pauses the current entry if there is one.
29427 module.exports = DirReader
29429 var fs = __webpack_require__(192)
29430 var inherits = __webpack_require__(66)
29431 var path = __webpack_require__(2)
29432 var Reader = __webpack_require__(191)
29433 var assert = __webpack_require__(58).ok
29435 inherits(DirReader, Reader)
29437 function DirReader (props) {
29439 if (!(self instanceof DirReader)) {
29440 throw new Error('DirReader must be called as constructor.')
29443 // should already be established as a Directory type
29444 if (props.type !== 'Directory' || !props.Directory) {
29445 throw new Error('Non-directory type ' + props.type)
29448 self.entries = null
29450 self._paused = false
29454 this.sort = props.sort
29457 Reader.call(this, props)
29460 DirReader.prototype._getEntries = function () {
29463 // race condition. might pause() before calling _getEntries,
29464 // and then resume, and try to get them a second time.
29465 if (self._gotEntries) return
29466 self._gotEntries = true
29468 fs.readdir(self._path, function (er, entries) {
29469 if (er) return self.error(er)
29471 self.entries = entries
29473 self.emit('entries', entries)
29474 if (self._paused) self.once('resume', processEntries)
29475 else processEntries()
29477 function processEntries () {
29478 self._length = self.entries.length
29479 if (typeof self.sort === 'function') {
29480 self.entries = self.entries.sort(self.sort.bind(self))
29487 // start walking the dir, and emit an "entry" event for each one.
29488 DirReader.prototype._read = function () {
29491 if (!self.entries) return self._getEntries()
29493 if (self._paused || self._currentEntry || self._aborted) {
29494 // console.error('DR paused=%j, current=%j, aborted=%j', self._paused, !!self._currentEntry, self._aborted)
29499 if (self._index >= self.entries.length) {
29500 if (!self._ended) {
29508 // ok, handle this one, then.
29510 // save creating a proxy, by stat'ing the thing now.
29511 var p = path.resolve(self._path, self.entries[self._index])
29512 assert(p !== self._path)
29513 assert(self.entries[self._index])
29515 // set this to prevent trying to _read() again in the stat time.
29516 self._currentEntry = p
29517 fs[ self.props.follow ? 'stat' : 'lstat' ](p, function (er, stat) {
29518 if (er) return self.error(er)
29520 var who = self._proxy || self
29523 stat.basename = path.basename(p)
29524 stat.dirname = path.dirname(p)
29525 var childProps = self.getChildProps.call(who, stat)
29526 childProps.path = p
29527 childProps.basename = path.basename(p)
29528 childProps.dirname = path.dirname(p)
29530 var entry = Reader(childProps, stat)
29532 // console.error("DR Entry", p, stat.size)
29534 self._currentEntry = entry
29536 // "entry" events are for direct entries in a specific dir.
29537 // "child" events are for any and all children at all levels.
29538 // This nomenclature is not completely final.
29540 entry.on('pause', function (who) {
29541 if (!self._paused && !entry._disowned) {
29546 entry.on('resume', function (who) {
29547 if (self._paused && !entry._disowned) {
29552 entry.on('stat', function (props) {
29553 self.emit('_entryStat', entry, props)
29554 if (entry._aborted) return
29555 if (entry._paused) {
29556 entry.once('resume', function () {
29557 self.emit('entryStat', entry, props)
29559 } else self.emit('entryStat', entry, props)
29562 entry.on('ready', function EMITCHILD () {
29563 // console.error("DR emit child", entry._path)
29564 if (self._paused) {
29565 // console.error(" DR emit child - try again later")
29566 // pause the child, and emit the "entry" event once we drain.
29567 // console.error("DR pausing child entry")
29569 return self.once('resume', EMITCHILD)
29572 // skip over sockets. they can't be piped around properly,
29573 // so there's really no sense even acknowledging them.
29574 // if someone really wants to see them, they can listen to
29575 // the "socket" events.
29576 if (entry.type === 'Socket') {
29577 self.emit('socket', entry)
29579 self.emitEntry(entry)
29584 entry.on('close', onend)
29585 entry.on('disown', onend)
29586 function onend () {
29589 self.emit('childEnd', entry)
29590 self.emit('entryEnd', entry)
29591 self._currentEntry = null
29592 if (!self._paused) {
29597 // XXX Remove this. Works in node as of 0.6.2 or so.
29598 // Long filenames should not break stuff.
29599 entry.on('error', function (er) {
29600 if (entry._swallowErrors) {
29603 entry.emit('close')
29605 self.emit('error', er)
29609 // proxy up some events.
29614 ].forEach(function (ev) {
29615 entry.on(ev, self.emit.bind(self, ev))
29620 DirReader.prototype.disown = function (entry) {
29621 entry.emit('beforeDisown')
29622 entry._disowned = true
29623 entry.parent = entry.root = null
29624 if (entry === this._currentEntry) {
29625 this._currentEntry = null
29627 entry.emit('disown')
29630 DirReader.prototype.getChildProps = function () {
29632 depth: this.depth + 1,
29633 root: this.root || this,
29635 follow: this.follow,
29636 filter: this.filter,
29637 sort: this.props.sort,
29638 hardlinks: this.props.hardlinks
29642 DirReader.prototype.pause = function (who) {
29644 if (self._paused) return
29646 self._paused = true
29647 if (self._currentEntry && self._currentEntry.pause) {
29648 self._currentEntry.pause(who)
29650 self.emit('pause', who)
29653 DirReader.prototype.resume = function (who) {
29655 if (!self._paused) return
29658 self._paused = false
29659 // console.error('DR Emit Resume', self._path)
29660 self.emit('resume', who)
29661 if (self._paused) {
29662 // console.error('DR Re-paused', self._path)
29666 if (self._currentEntry) {
29667 if (self._currentEntry.resume) self._currentEntry.resume(who)
29668 } else self._read()
29671 DirReader.prototype.emitEntry = function (entry) {
29672 this.emit('entry', entry)
29673 this.emit('child', entry)
29679 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29681 // Basically just a wrapper around an fs.ReadStream
29683 module.exports = FileReader
29685 var fs = __webpack_require__(192)
29686 var inherits = __webpack_require__(66)
29687 var Reader = __webpack_require__(191)
29688 var EOF = {EOF: true}
29689 var CLOSE = {CLOSE: true}
29691 inherits(FileReader, Reader)
29693 function FileReader (props) {
29694 // console.error(" FR create", props.path, props.size, new Error().stack)
29696 if (!(self instanceof FileReader)) {
29697 throw new Error('FileReader must be called as constructor.')
29700 // should already be established as a File type
29701 // XXX Todo: preserve hardlinks by tracking dev+inode+nlink,
29702 // with a HardLinkReader class.
29703 if (!((props.type === 'Link' && props.Link) ||
29704 (props.type === 'File' && props.File))) {
29705 throw new Error('Non-file type ' + props.type)
29709 self._bytesEmitted = 0
29710 Reader.call(self, props)
29713 FileReader.prototype._getStream = function () {
29715 var stream = self._stream = fs.createReadStream(self._path, self.props)
29717 if (self.props.blksize) {
29718 stream.bufferSize = self.props.blksize
29721 stream.on('open', self.emit.bind(self, 'open'))
29723 stream.on('data', function (c) {
29724 // console.error('\t\t%d %s', c.length, self.basename)
29725 self._bytesEmitted += c.length
29726 // no point saving empty chunks
29729 } else if (self._paused || self._buffer.length) {
29730 self._buffer.push(c)
29732 } else self.emit('data', c)
29735 stream.on('end', function () {
29736 if (self._paused || self._buffer.length) {
29737 // console.error('FR Buffering End', self._path)
29738 self._buffer.push(EOF)
29744 if (self._bytesEmitted !== self.props.size) {
29745 self.error("Didn't get expected byte count\n" +
29746 'expect: ' + self.props.size + '\n' +
29747 'actual: ' + self._bytesEmitted)
29751 stream.on('close', function () {
29752 if (self._paused || self._buffer.length) {
29753 // console.error('FR Buffering Close', self._path)
29754 self._buffer.push(CLOSE)
29757 // console.error('FR close 1', self._path)
29762 stream.on('error', function (e) {
29763 self.emit('error', e)
29769 FileReader.prototype._read = function () {
29771 // console.error('FR _read', self._path)
29772 if (self._paused) {
29773 // console.error('FR _read paused', self._path)
29777 if (!self._stream) {
29778 // console.error('FR _getStream calling', self._path)
29779 return self._getStream()
29782 // clear out the buffer, if there is one.
29783 if (self._buffer.length) {
29784 // console.error('FR _read has buffer', self._buffer.length, self._path)
29785 var buf = self._buffer
29786 for (var i = 0, l = buf.length; i < l; i++) {
29789 // console.error('FR Read emitting buffered end', self._path)
29791 } else if (c === CLOSE) {
29792 // console.error('FR Read emitting buffered close', self._path)
29795 // console.error('FR Read emitting buffered data', self._path)
29796 self.emit('data', c)
29799 if (self._paused) {
29800 // console.error('FR Read Re-pausing at '+i, self._path)
29801 self._buffer = buf.slice(i)
29805 self._buffer.length = 0
29807 // console.error("FR _read done")
29808 // that's about all there is to it.
29811 FileReader.prototype.pause = function (who) {
29813 // console.error('FR Pause', self._path)
29814 if (self._paused) return
29816 self._paused = true
29817 if (self._stream) self._stream.pause()
29818 self.emit('pause', who)
29821 FileReader.prototype.resume = function (who) {
29823 // console.error('FR Resume', self._path)
29824 if (!self._paused) return
29826 self.emit('resume', who)
29827 self._paused = false
29828 if (self._stream) self._stream.resume()
29835 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29837 // Just get the stats, and then don't do anything.
29838 // You can't really "read" from a socket. You "connect" to it.
29839 // Mostly, this is here so that reading a dir with a socket in it
29840 // doesn't blow up.
29842 module.exports = SocketReader
29844 var inherits = __webpack_require__(66)
29845 var Reader = __webpack_require__(191)
29847 inherits(SocketReader, Reader)
29849 function SocketReader (props) {
29851 if (!(self instanceof SocketReader)) {
29852 throw new Error('SocketReader must be called as constructor.')
29855 if (!(props.type === 'Socket' && props.Socket)) {
29856 throw new Error('Non-socket type ' + props.type)
29859 Reader.call(self, props)
29862 SocketReader.prototype._read = function () {
29864 if (self._paused) return
29865 // basically just a no-op, since we got all the info we have
29866 // from the _stat method
29867 if (!self._ended) {
29877 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29879 // A reader for when we don't yet know what kind of thing
29882 module.exports = ProxyReader
29884 var Reader = __webpack_require__(191)
29885 var getType = __webpack_require__(197)
29886 var inherits = __webpack_require__(66)
29887 var fs = __webpack_require__(192)
29889 inherits(ProxyReader, Reader)
29891 function ProxyReader (props) {
29893 if (!(self instanceof ProxyReader)) {
29894 throw new Error('ProxyReader must be called as constructor.')
29901 Reader.call(self, props)
29904 ProxyReader.prototype._stat = function () {
29906 var props = self.props
29907 // stat the thing to see what the proxy should be.
29908 var stat = props.follow ? 'stat' : 'lstat'
29910 fs[stat](props.path, function (er, current) {
29912 if (er || !current) {
29915 type = getType(current)
29919 props.type = self.type = type
29921 self._old = current
29922 self._addProxy(Reader(props, current))
29926 ProxyReader.prototype._addProxy = function (proxy) {
29928 if (self._proxyTarget) {
29929 return self.error('proxy already set')
29932 self._proxyTarget = proxy
29933 proxy._proxy = self
29947 ].forEach(function (ev) {
29948 // console.error('~~ proxy event', ev, self.path)
29949 proxy.on(ev, self.emit.bind(self, ev))
29952 self.emit('proxy', proxy)
29954 proxy.on('ready', function () {
29955 // console.error("~~ proxy is ready!", self.path)
29960 var calls = self._buffer
29961 self._buffer.length = 0
29962 calls.forEach(function (c) {
29963 proxy[c[0]].apply(proxy, c[1])
29967 ProxyReader.prototype.pause = function () {
29968 return this._proxyTarget ? this._proxyTarget.pause() : false
29971 ProxyReader.prototype.resume = function () {
29972 return this._proxyTarget ? this._proxyTarget.resume() : false
29978 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29980 module.exports = Writer
29982 var fs = __webpack_require__(192)
29983 var inherits = __webpack_require__(66)
29984 var rimraf = __webpack_require__(204)
29985 var mkdir = __webpack_require__(205)
29986 var path = __webpack_require__(2)
29987 var umask = process.platform === 'win32' ? 0 : process.umask()
29988 var getType = __webpack_require__(197)
29989 var Abstract = __webpack_require__(190)
29991 // Must do this *before* loading the child classes
29992 inherits(Writer, Abstract)
29994 Writer.dirmode = parseInt('0777', 8) & (~umask)
29995 Writer.filemode = parseInt('0666', 8) & (~umask)
29997 var DirWriter = __webpack_require__(206)
29998 var LinkWriter = __webpack_require__(208)
29999 var FileWriter = __webpack_require__(209)
30000 var ProxyWriter = __webpack_require__(210)
30002 // props is the desired state. current is optionally the current stat,
30003 // provided here so that subclasses can avoid statting the target
30004 // more than necessary.
30005 function Writer (props, current) {
30008 if (typeof props === 'string') {
30009 props = { path: props }
30013 // call fstream.Writer(dir) to get a DirWriter object, etc.
30014 var type = getType(props)
30015 var ClassType = Writer
30019 ClassType = DirWriter
30022 ClassType = FileWriter
30025 case 'SymbolicLink':
30026 ClassType = LinkWriter
30030 // Don't know yet what type to create, so we wrap in a proxy.
30031 ClassType = ProxyWriter
30035 if (!(self instanceof ClassType)) return new ClassType(props)
30037 // now get down to business.
30039 Abstract.call(self)
30041 if (!props.path) self.error('Must provide a path', null, true)
30043 // props is what we want to set.
30044 // set some convenience properties as well.
30045 self.type = props.type
30047 self.depth = props.depth || 0
30048 self.clobber = props.clobber === false ? props.clobber : true
30049 self.parent = props.parent || null
30050 self.root = props.root || (props.parent && props.parent.root) || self
30052 self._path = self.path = path.resolve(props.path)
30053 if (process.platform === 'win32') {
30054 self.path = self._path = self.path.replace(/\?/g, '_')
30055 if (self._path.length >= 260) {
30056 self._swallowErrors = true
30057 self._path = '\\\\?\\' + self.path.replace(/\//g, '\\')
30060 self.basename = path.basename(props.path)
30061 self.dirname = path.dirname(props.path)
30062 self.linkpath = props.linkpath || null
30064 props.parent = props.root = null
30066 // console.error("\n\n\n%s setting size to", props.path, props.size)
30067 self.size = props.size
30069 if (typeof props.mode === 'string') {
30070 props.mode = parseInt(props.mode, 8)
30073 self.readable = false
30074 self.writable = true
30076 // buffer until ready, or while handling another entry
30080 self.filter = typeof props.filter === 'function' ? props.filter : null
30082 // start the ball rolling.
30083 // this checks what's there already, and then calls
30084 // self._create() to call the impl-specific creation stuff.
30085 self._stat(current)
30088 // Calling this means that it's something we can't create.
30089 // Just assert that it's already there, otherwise raise a warning.
30090 Writer.prototype._create = function () {
30092 fs[self.props.follow ? 'stat' : 'lstat'](self._path, function (er) {
30094 return self.warn('Cannot create ' + self._path + '\n' +
30095 'Unsupported type: ' + self.type, 'ENOTSUP')
30101 Writer.prototype._stat = function (current) {
30103 var props = self.props
30104 var stat = props.follow ? 'stat' : 'lstat'
30105 var who = self._proxy || self
30107 if (current) statCb(null, current)
30108 else fs[stat](self._path, statCb)
30110 function statCb (er, current) {
30111 if (self.filter && !self.filter.call(who, who, current)) {
30112 self._aborted = true
30118 // if it's not there, great. We'll just create it.
30119 // if it is there, then we'll need to change whatever differs
30120 if (er || !current) {
30121 return create(self)
30124 self._old = current
30125 var currentType = getType(current)
30127 // if it's a type change, then we need to clobber or error.
30128 // if it's not a type change, then let the impl take care of it.
30129 if (currentType !== self.type || self.type === 'File' && current.nlink > 1) {
30130 return rimraf(self._path, function (er) {
30131 if (er) return self.error(er)
30137 // otherwise, just handle in the app-specific way
30138 // this creates a fs.WriteStream, or mkdir's, or whatever
30143 function create (self) {
30144 // console.error("W create", self._path, Writer.dirmode)
30146 // XXX Need to clobber non-dirs that are in the way,
30147 // unless { clobber: false } in the props.
30148 mkdir(path.dirname(self._path), Writer.dirmode, function (er, made) {
30149 // console.error("W created", path.dirname(self._path), er)
30150 if (er) return self.error(er)
30152 // later on, we have to set the mode and owner for these
30153 self._madeDir = made
30154 return self._create()
30158 function endChmod (self, want, current, path, cb) {
30159 var wantMode = want.mode
30160 var chmod = want.follow || self.type !== 'SymbolicLink'
30161 ? 'chmod' : 'lchmod'
30163 if (!fs[chmod]) return cb()
30164 if (typeof wantMode !== 'number') return cb()
30166 var curMode = current.mode & parseInt('0777', 8)
30167 wantMode = wantMode & parseInt('0777', 8)
30168 if (wantMode === curMode) return cb()
30170 fs[chmod](path, wantMode, cb)
30173 function endChown (self, want, current, path, cb) {
30174 // Don't even try it unless root. Too easy to EPERM.
30175 if (process.platform === 'win32') return cb()
30176 if (!process.getuid || process.getuid() !== 0) return cb()
30177 if (typeof want.uid !== 'number' &&
30178 typeof want.gid !== 'number') return cb()
30180 if (current.uid === want.uid &&
30181 current.gid === want.gid) return cb()
30183 var chown = (self.props.follow || self.type !== 'SymbolicLink')
30184 ? 'chown' : 'lchown'
30185 if (!fs[chown]) return cb()
30187 if (typeof want.uid !== 'number') want.uid = current.uid
30188 if (typeof want.gid !== 'number') want.gid = current.gid
30190 fs[chown](path, want.uid, want.gid, cb)
30193 function endUtimes (self, want, current, path, cb) {
30194 if (!fs.utimes || process.platform === 'win32') return cb()
30196 var utimes = (want.follow || self.type !== 'SymbolicLink')
30197 ? 'utimes' : 'lutimes'
30199 if (utimes === 'lutimes' && !fs[utimes]) {
30203 if (!fs[utimes]) return cb()
30205 var curA = current.atime
30206 var curM = current.mtime
30207 var meA = want.atime
30208 var meM = want.mtime
30210 if (meA === undefined) meA = curA
30211 if (meM === undefined) meM = curM
30213 if (!isDate(meA)) meA = new Date(meA)
30214 if (!isDate(meM)) meA = new Date(meM)
30216 if (meA.getTime() === curA.getTime() &&
30217 meM.getTime() === curM.getTime()) return cb()
30219 fs[utimes](path, meA, meM, cb)
30222 // XXX This function is beastly. Break it up!
30223 Writer.prototype._finish = function () {
30226 if (self._finishing) return
30227 self._finishing = true
30229 // console.error(" W Finish", self._path, self.size)
30231 // set up all the things.
30232 // At this point, we're already done writing whatever we've gotta write,
30233 // adding files to the dir, etc.
30235 var errState = null
30239 // the times will almost *certainly* have changed.
30240 // adds the utimes syscall, but remove another stat.
30241 self._old.atime = new Date(0)
30242 self._old.mtime = new Date(0)
30243 // console.error(" W Finish Stale Stat", self._path, self.size)
30244 setProps(self._old)
30246 var stat = self.props.follow ? 'stat' : 'lstat'
30247 // console.error(" W Finish Stating", self._path, self.size)
30248 fs[stat](self._path, function (er, current) {
30249 // console.error(" W Finish Stated", self._path, self.size, current)
30251 // if we're in the process of writing out a
30252 // directory, it's very possible that the thing we're linking to
30253 // doesn't exist yet (especially if it was intended as a symlink),
30254 // so swallow ENOENT errors here and just soldier on.
30255 if (er.code === 'ENOENT' &&
30256 (self.type === 'Link' || self.type === 'SymbolicLink') &&
30257 process.platform === 'win32') {
30262 self.end = self._finish = function () {}
30264 } else return self.error(er)
30266 setProps(self._old = current)
30272 function setProps (current) {
30274 endChmod(self, self.props, current, self._path, next('chmod'))
30275 endChown(self, self.props, current, self._path, next('chown'))
30276 endUtimes(self, self.props, current, self._path, next('utimes'))
30279 function next (what) {
30280 return function (er) {
30281 // console.error(" W Finish", what, todo)
30282 if (errState) return
30284 er.fstream_finish_call = what
30285 return self.error(errState = er)
30287 if (--todo > 0) return
30291 // we may still need to set the mode/etc. on some parent dirs
30292 // that were created previously. delay end/close until then.
30293 if (!self._madeDir) return end()
30294 else endMadeDir(self, self._path, end)
30296 function end (er) {
30298 er.fstream_finish_call = 'setupMadeDir'
30299 return self.error(er)
30301 // all the props have been set, so we're completely done.
30309 function endMadeDir (self, p, cb) {
30310 var made = self._madeDir
30311 // everything *between* made and path.dirname(self._path)
30312 // needs to be set up. Note that this may just be one dir.
30313 var d = path.dirname(p)
30315 endMadeDir_(self, d, function (er) {
30316 if (er) return cb(er)
30320 endMadeDir(self, d, cb)
30324 function endMadeDir_ (self, p, cb) {
30326 Object.keys(self.props).forEach(function (k) {
30327 dirProps[k] = self.props[k]
30329 // only make non-readable dirs if explicitly requested.
30330 if (k === 'mode' && self.type !== 'Directory') {
30331 dirProps[k] = dirProps[k] | parseInt('0111', 8)
30336 var errState = null
30337 fs.stat(p, function (er, current) {
30338 if (er) return cb(errState = er)
30339 endChmod(self, dirProps, current, p, next)
30340 endChown(self, dirProps, current, p, next)
30341 endUtimes(self, dirProps, current, p, next)
30344 function next (er) {
30345 if (errState) return
30346 if (er) return cb(errState = er)
30347 if (--todo === 0) return cb()
30351 Writer.prototype.pipe = function () {
30352 this.error("Can't pipe from writable stream")
30355 Writer.prototype.add = function () {
30356 this.error("Can't add to non-Directory type")
30359 Writer.prototype.write = function () {
30363 function objectToString (d) {
30364 return Object.prototype.toString.call(d)
30367 function isDate (d) {
30368 return typeof d === 'object' && objectToString(d) === '[object Date]'
30374 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
30376 module.exports = rimraf
30377 rimraf.sync = rimrafSync
30379 var assert = __webpack_require__(58)
30380 var path = __webpack_require__(2)
30381 var fs = __webpack_require__(42)
30382 var glob = undefined
30384 glob = __webpack_require__(59)
30386 // treat glob as optional.
30388 var _0666 = parseInt('666', 8)
30390 var defaultGlobOpts = {
30395 // for EMFILE handling
30398 var isWindows = (process.platform === "win32")
30400 function defaults (options) {
30409 methods.forEach(function(m) {
30410 options[m] = options[m] || fs[m]
30412 options[m] = options[m] || fs[m]
30415 options.maxBusyTries = options.maxBusyTries || 3
30416 options.emfileWait = options.emfileWait || 1000
30417 if (options.glob === false) {
30418 options.disableGlob = true
30420 if (options.disableGlob !== true && glob === undefined) {
30421 throw Error('glob dependency not found, set `options.disableGlob = true` if intentional')
30423 options.disableGlob = options.disableGlob || false
30424 options.glob = options.glob || defaultGlobOpts
30427 function rimraf (p, options, cb) {
30428 if (typeof options === 'function') {
30433 assert(p, 'rimraf: missing path')
30434 assert.equal(typeof p, 'string', 'rimraf: path should be a string')
30435 assert.equal(typeof cb, 'function', 'rimraf: callback function required')
30436 assert(options, 'rimraf: invalid options argument provided')
30437 assert.equal(typeof options, 'object', 'rimraf: options should be object')
30442 var errState = null
30445 if (options.disableGlob || !glob.hasMagic(p))
30446 return afterGlob(null, [p])
30448 options.lstat(p, function (er, stat) {
30450 return afterGlob(null, [p])
30452 glob(p, options.glob, afterGlob)
30455 function next (er) {
30456 errState = errState || er
30461 function afterGlob (er, results) {
30469 results.forEach(function (p) {
30470 rimraf_(p, options, function CB (er) {
30472 if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
30473 busyTries < options.maxBusyTries) {
30475 var time = busyTries * 100
30476 // try again, with the same exact callback as this one.
30477 return setTimeout(function () {
30478 rimraf_(p, options, CB)
30482 // this one won't happen if graceful-fs is used.
30483 if (er.code === "EMFILE" && timeout < options.emfileWait) {
30484 return setTimeout(function () {
30485 rimraf_(p, options, CB)
30490 if (er.code === "ENOENT") er = null
30500 // Two possible strategies.
30501 // 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
30502 // 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
30504 // Both result in an extra syscall when you guess wrong. However, there
30505 // are likely far more normal files in the world than directories. This
30506 // is based on the assumption that a the average number of files per
30507 // directory is >= 1.
30509 // If anyone ever complains about this, then I guess the strategy could
30510 // be made configurable somehow. But until then, YAGNI.
30511 function rimraf_ (p, options, cb) {
30514 assert(typeof cb === 'function')
30516 // sunos lets the root user unlink directories, which is... weird.
30517 // so we have to lstat here and make sure it's not a dir.
30518 options.lstat(p, function (er, st) {
30519 if (er && er.code === "ENOENT")
30522 // Windows can EPERM on stat. Life is suffering.
30523 if (er && er.code === "EPERM" && isWindows)
30524 fixWinEPERM(p, options, er, cb)
30526 if (st && st.isDirectory())
30527 return rmdir(p, options, er, cb)
30529 options.unlink(p, function (er) {
30531 if (er.code === "ENOENT")
30533 if (er.code === "EPERM")
30535 ? fixWinEPERM(p, options, er, cb)
30536 : rmdir(p, options, er, cb)
30537 if (er.code === "EISDIR")
30538 return rmdir(p, options, er, cb)
30545 function fixWinEPERM (p, options, er, cb) {
30548 assert(typeof cb === 'function')
30550 assert(er instanceof Error)
30552 options.chmod(p, _0666, function (er2) {
30554 cb(er2.code === "ENOENT" ? null : er)
30556 options.stat(p, function(er3, stats) {
30558 cb(er3.code === "ENOENT" ? null : er)
30559 else if (stats.isDirectory())
30560 rmdir(p, options, er, cb)
30562 options.unlink(p, cb)
30567 function fixWinEPERMSync (p, options, er) {
30571 assert(er instanceof Error)
30574 options.chmodSync(p, _0666)
30576 if (er2.code === "ENOENT")
30583 var stats = options.statSync(p)
30585 if (er3.code === "ENOENT")
30591 if (stats.isDirectory())
30592 rmdirSync(p, options, er)
30594 options.unlinkSync(p)
30597 function rmdir (p, options, originalEr, cb) {
30601 assert(originalEr instanceof Error)
30602 assert(typeof cb === 'function')
30604 // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
30605 // if we guessed wrong, and it's not a directory, then
30606 // raise the original error.
30607 options.rmdir(p, function (er) {
30608 if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
30609 rmkids(p, options, cb)
30610 else if (er && er.code === "ENOTDIR")
30617 function rmkids(p, options, cb) {
30620 assert(typeof cb === 'function')
30622 options.readdir(p, function (er, files) {
30625 var n = files.length
30627 return options.rmdir(p, cb)
30629 files.forEach(function (f) {
30630 rimraf(path.join(p, f), options, function (er) {
30634 return cb(errState = er)
30636 options.rmdir(p, cb)
30642 // this looks simpler, and is strictly *faster*, but will
30643 // tie up the JavaScript thread and fail on excessively
30644 // deep directory trees.
30645 function rimrafSync (p, options) {
30646 options = options || {}
30649 assert(p, 'rimraf: missing path')
30650 assert.equal(typeof p, 'string', 'rimraf: path should be a string')
30651 assert(options, 'rimraf: missing options')
30652 assert.equal(typeof options, 'object', 'rimraf: options should be object')
30656 if (options.disableGlob || !glob.hasMagic(p)) {
30660 options.lstatSync(p)
30663 results = glob.sync(p, options.glob)
30667 if (!results.length)
30670 for (var i = 0; i < results.length; i++) {
30674 var st = options.lstatSync(p)
30676 if (er.code === "ENOENT")
30679 // Windows can EPERM on stat. Life is suffering.
30680 if (er.code === "EPERM" && isWindows)
30681 fixWinEPERMSync(p, options, er)
30685 // sunos lets the root user unlink directories, which is... weird.
30686 if (st && st.isDirectory())
30687 rmdirSync(p, options, null)
30689 options.unlinkSync(p)
30691 if (er.code === "ENOENT")
30693 if (er.code === "EPERM")
30694 return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
30695 if (er.code !== "EISDIR")
30698 rmdirSync(p, options, er)
30703 function rmdirSync (p, options, originalEr) {
30707 assert(originalEr instanceof Error)
30710 options.rmdirSync(p)
30712 if (er.code === "ENOENT")
30714 if (er.code === "ENOTDIR")
30716 if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
30717 rmkidsSync(p, options)
30721 function rmkidsSync (p, options) {
30724 options.readdirSync(p).forEach(function (f) {
30725 rimrafSync(path.join(p, f), options)
30728 // We only end up here once we got ENOTEMPTY at least once, and
30729 // at this point, we are guaranteed to have removed all the kids.
30730 // So, we know that it won't be ENOENT or ENOTDIR or anything else.
30731 // try really hard to delete stuff on windows, because it has a
30732 // PROFOUNDLY annoying habit of not closing handles promptly when
30733 // files are deleted, resulting in spurious ENOTEMPTY errors.
30734 var retries = isWindows ? 100 : 1
30739 var ret = options.rmdirSync(p, options)
30743 if (++i < retries && threw)
30752 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
30754 var path = __webpack_require__(2);
30755 var fs = __webpack_require__(42);
30756 var _0777 = parseInt('0777', 8);
30758 module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
30760 function mkdirP (p, opts, f, made) {
30761 if (typeof opts === 'function') {
30765 else if (!opts || typeof opts !== 'object') {
30766 opts = { mode: opts };
30769 var mode = opts.mode;
30770 var xfs = opts.fs || fs;
30772 if (mode === undefined) {
30775 if (!made) made = null;
30777 var cb = f || function () {};
30778 p = path.resolve(p);
30780 xfs.mkdir(p, mode, function (er) {
30783 return cb(null, made);
30787 if (path.dirname(p) === p) return cb(er);
30788 mkdirP(path.dirname(p), opts, function (er, made) {
30789 if (er) cb(er, made);
30790 else mkdirP(p, opts, cb, made);
30794 // In the case of any other error, just see if there's a dir
30795 // there already. If so, then hooray! If not, then something
30798 xfs.stat(p, function (er2, stat) {
30799 // if the stat fails, then that's super weird.
30800 // let the original error be the failure reason.
30801 if (er2 || !stat.isDirectory()) cb(er, made)
30802 else cb(null, made);
30809 mkdirP.sync = function sync (p, opts, made) {
30810 if (!opts || typeof opts !== 'object') {
30811 opts = { mode: opts };
30814 var mode = opts.mode;
30815 var xfs = opts.fs || fs;
30817 if (mode === undefined) {
30820 if (!made) made = null;
30822 p = path.resolve(p);
30825 xfs.mkdirSync(p, mode);
30829 switch (err0.code) {
30831 made = sync(path.dirname(p), opts, made);
30832 sync(p, opts, made);
30835 // In the case of any other error, just see if there's a dir
30836 // there already. If so, then hooray! If not, then something
30841 stat = xfs.statSync(p);
30846 if (!stat.isDirectory()) throw err0;
30857 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
30859 // It is expected that, when .add() returns false, the consumer
30860 // of the DirWriter will pause until a "drain" event occurs. Note
30861 // that this is *almost always going to be the case*, unless the
30862 // thing being written is some sort of unsupported type, and thus
30865 module.exports = DirWriter
30867 var Writer = __webpack_require__(203)
30868 var inherits = __webpack_require__(66)
30869 var mkdir = __webpack_require__(205)
30870 var path = __webpack_require__(2)
30871 var collect = __webpack_require__(207)
30873 inherits(DirWriter, Writer)
30875 function DirWriter (props) {
30877 if (!(self instanceof DirWriter)) {
30878 self.error('DirWriter must be called as constructor.', null, true)
30881 // should already be established as a Directory type
30882 if (props.type !== 'Directory' || !props.Directory) {
30883 self.error('Non-directory type ' + props.type + ' ' +
30884 JSON.stringify(props), null, true)
30887 Writer.call(this, props)
30890 DirWriter.prototype._create = function () {
30892 mkdir(self._path, Writer.dirmode, function (er) {
30893 if (er) return self.error(er)
30894 // ready to start getting entries!
30901 // a DirWriter has an add(entry) method, but its .write() doesn't
30902 // do anything. Why a no-op rather than a throw? Because this
30903 // leaves open the door for writing directory metadata for
30904 // gnu/solaris style dumpdirs.
30905 DirWriter.prototype.write = function () {
30909 DirWriter.prototype.end = function () {
30914 DirWriter.prototype.add = function (entry) {
30917 // console.error('\tadd', entry._path, '->', self._path)
30919 if (!self.ready || self._currentEntry) {
30920 self._buffer.push(entry)
30924 // create a new writer, and pipe the incoming entry into it.
30926 return self.error('add after end')
30929 self._buffer.push(entry)
30932 return this._buffer.length === 0
30935 DirWriter.prototype._process = function () {
30938 // console.error('DW Process p=%j', self._processing, self.basename)
30940 if (self._processing) return
30942 var entry = self._buffer.shift()
30944 // console.error("DW Drain")
30946 if (self._ended) self._finish()
30950 self._processing = true
30951 // console.error("DW Entry", entry._path)
30953 self.emit('entry', entry)
30955 // ok, add this entry
30957 // don't allow recursive copying
30961 pp = p._path || p.path
30962 if (pp === self.root._path || pp === self._path ||
30963 (pp && pp.indexOf(self._path) === 0)) {
30964 // console.error('DW Exit (recursive)', entry.basename, self._path)
30965 self._processing = false
30966 if (entry._collected) entry.pipe()
30967 return self._process()
30972 // console.error("DW not recursive")
30974 // chop off the entry's root dir, replace with ours
30977 root: self.root || self,
30979 depth: self.depth + 1
30982 pp = entry._path || entry.path || entry.props.path
30983 if (entry.parent) {
30984 pp = pp.substr(entry.parent._path.length + 1)
30986 // get rid of any ../../ shenanigans
30987 props.path = path.join(self.path, path.join('/', pp))
30989 // if i have a filter, the child should inherit it.
30990 props.filter = self.filter
30992 // all the rest of the stuff, copy over from the source.
30993 Object.keys(entry.props).forEach(function (k) {
30994 if (!props.hasOwnProperty(k)) {
30995 props[k] = entry.props[k]
30999 // not sure at this point what kind of writer this is.
31000 var child = self._currentChild = new Writer(props)
31001 child.on('ready', function () {
31002 // console.error("DW Child Ready", child.type, child._path)
31003 // console.error(" resuming", entry._path)
31008 // XXX Make this work in node.
31009 // Long filenames should not break stuff.
31010 child.on('error', function (er) {
31011 if (child._swallowErrors) {
31014 child.emit('close')
31016 self.emit('error', er)
31020 // we fire _end internally *after* end, so that we don't move on
31021 // until any "end" listeners have had their chance to do stuff.
31022 child.on('close', onend)
31024 function onend () {
31027 // console.error("* DW Child end", child.basename)
31028 self._currentChild = null
31029 self._processing = false
31037 /***/ ((module) => {
31039 module.exports = collect
31041 function collect (stream) {
31042 if (stream._collected) return
31044 if (stream._paused) return stream.on('resume', collect.bind(null, stream))
31046 stream._collected = true
31049 stream.on('data', save)
31050 stream.on('end', save)
31052 function save (b) {
31053 if (typeof b === 'string') b = new Buffer(b)
31054 if (Buffer.isBuffer(b) && !b.length) return
31058 stream.on('entry', saveEntry)
31059 var entryBuffer = []
31060 function saveEntry (e) {
31062 entryBuffer.push(e)
31065 stream.on('proxy', proxyPause)
31066 function proxyPause (p) {
31070 // replace the pipe method with a new version that will
31071 // unlock the buffered stuff. if you just call .pipe()
31072 // without a destination, then it'll re-play the events.
31073 stream.pipe = (function (orig) {
31074 return function (dest) {
31075 // console.error(' === open the pipes', dest && dest.path)
31077 // let the entries flow through one at a time.
31078 // Once they're all done, then we can resume completely.
31080 ;(function unblockEntry () {
31081 var entry = entryBuffer[e++]
31082 // console.error(" ==== unblock entry", entry && entry.path)
31083 if (!entry) return resume()
31084 entry.on('end', unblockEntry)
31085 if (dest) dest.add(entry)
31086 else stream.emit('entry', entry)
31089 function resume () {
31090 stream.removeListener('entry', saveEntry)
31091 stream.removeListener('data', save)
31092 stream.removeListener('end', save)
31095 if (dest) stream.pipe(dest)
31097 buf.forEach(function (b) {
31098 if (b) stream.emit('data', b)
31099 else stream.emit('end')
31113 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31115 module.exports = LinkWriter
31117 var fs = __webpack_require__(192)
31118 var Writer = __webpack_require__(203)
31119 var inherits = __webpack_require__(66)
31120 var path = __webpack_require__(2)
31121 var rimraf = __webpack_require__(204)
31123 inherits(LinkWriter, Writer)
31125 function LinkWriter (props) {
31127 if (!(self instanceof LinkWriter)) {
31128 throw new Error('LinkWriter must be called as constructor.')
31131 // should already be established as a Link type
31132 if (!((props.type === 'Link' && props.Link) ||
31133 (props.type === 'SymbolicLink' && props.SymbolicLink))) {
31134 throw new Error('Non-link type ' + props.type)
31137 if (props.linkpath === '') props.linkpath = '.'
31138 if (!props.linkpath) {
31139 self.error('Need linkpath property to create ' + props.type)
31142 Writer.call(this, props)
31145 LinkWriter.prototype._create = function () {
31146 // console.error(" LW _create")
31148 var hard = self.type === 'Link' || process.platform === 'win32'
31149 var link = hard ? 'link' : 'symlink'
31150 var lp = hard ? path.resolve(self.dirname, self.linkpath) : self.linkpath
31152 // can only change the link path by clobbering
31153 // For hard links, let's just assume that's always the case, since
31154 // there's no good way to read them if we don't already know.
31155 if (hard) return clobber(self, lp, link)
31157 fs.readlink(self._path, function (er, p) {
31158 // only skip creation if it's exactly the same link
31159 if (p && p === lp) return finish(self)
31160 clobber(self, lp, link)
31164 function clobber (self, lp, link) {
31165 rimraf(self._path, function (er) {
31166 if (er) return self.error(er)
31167 create(self, lp, link)
31171 function create (self, lp, link) {
31172 fs[link](lp, self._path, function (er) {
31173 // if this is a hard link, and we're in the process of writing out a
31174 // directory, it's very possible that the thing we're linking to
31175 // doesn't exist yet (especially if it was intended as a symlink),
31176 // so swallow ENOENT errors here and just soldier in.
31177 // Additionally, an EPERM or EACCES can happen on win32 if it's trying
31178 // to make a link to a directory. Again, just skip it.
31179 // A better solution would be to have fs.symlink be supported on
31180 // windows in some nice fashion.
31182 if ((er.code === 'ENOENT' ||
31183 er.code === 'EACCES' ||
31184 er.code === 'EPERM') && process.platform === 'win32') {
31189 self.end = self._finish = function () {}
31190 } else return self.error(er)
31196 function finish (self) {
31199 if (self._ended && !self._finished) self._finish()
31202 LinkWriter.prototype.end = function () {
31203 // console.error("LW finish in end")
31206 this._finished = true
31214 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31216 module.exports = FileWriter
31218 var fs = __webpack_require__(192)
31219 var Writer = __webpack_require__(203)
31220 var inherits = __webpack_require__(66)
31223 inherits(FileWriter, Writer)
31225 function FileWriter (props) {
31227 if (!(self instanceof FileWriter)) {
31228 throw new Error('FileWriter must be called as constructor.')
31231 // should already be established as a File type
31232 if (props.type !== 'File' || !props.File) {
31233 throw new Error('Non-file type ' + props.type)
31237 self._bytesWritten = 0
31239 Writer.call(this, props)
31242 FileWriter.prototype._create = function () {
31244 if (self._stream) return
31247 if (self.props.flags) so.flags = self.props.flags
31248 so.mode = Writer.filemode
31249 if (self._old && self._old.blksize) so.bufferSize = self._old.blksize
31251 self._stream = fs.createWriteStream(self._path, so)
31253 self._stream.on('open', function () {
31254 // console.error("FW open", self._buffer, self._path)
31256 self._buffer.forEach(function (c) {
31257 if (c === EOF) self._stream.end()
31258 else self._stream.write(c)
31261 // give this a kick just in case it needs it.
31265 self._stream.on('error', function (er) { self.emit('error', er) })
31267 self._stream.on('drain', function () { self.emit('drain') })
31269 self._stream.on('close', function () {
31270 // console.error('\n\nFW Stream Close', self._path, self.size)
31275 FileWriter.prototype.write = function (c) {
31278 self._bytesWritten += c.length
31281 if (!Buffer.isBuffer(c) && typeof c !== 'string') {
31282 throw new Error('invalid write data')
31284 self._buffer.push(c)
31288 var ret = self._stream.write(c)
31289 // console.error('\t-- fw wrote, _stream says', ret, self._stream._queue.length)
31291 // allow 2 buffered writes, because otherwise there's just too
31292 // much stop and go bs.
31293 if (ret === false && self._stream._queue) {
31294 return self._stream._queue.length <= 2
31300 FileWriter.prototype.end = function (c) {
31303 if (c) self.write(c)
31306 self._buffer.push(EOF)
31310 return self._stream.end()
31313 FileWriter.prototype._finish = function () {
31315 if (typeof self.size === 'number' && self._bytesWritten !== self.size) {
31317 'Did not get expected byte count.\n' +
31318 'expect: ' + self.size + '\n' +
31319 'actual: ' + self._bytesWritten)
31321 Writer.prototype._finish.call(self)
31327 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31329 // A writer for when we don't know what kind of thing
31330 // the thing is. That is, it's not explicitly set,
31331 // so we're going to make it whatever the thing already
31334 // Until then, collect all events.
31336 module.exports = ProxyWriter
31338 var Writer = __webpack_require__(203)
31339 var getType = __webpack_require__(197)
31340 var inherits = __webpack_require__(66)
31341 var collect = __webpack_require__(207)
31342 var fs = __webpack_require__(42)
31344 inherits(ProxyWriter, Writer)
31346 function ProxyWriter (props) {
31348 if (!(self instanceof ProxyWriter)) {
31349 throw new Error('ProxyWriter must be called as constructor.')
31353 self._needDrain = false
31355 Writer.call(self, props)
31358 ProxyWriter.prototype._stat = function () {
31360 var props = self.props
31361 // stat the thing to see what the proxy should be.
31362 var stat = props.follow ? 'stat' : 'lstat'
31364 fs[stat](props.path, function (er, current) {
31366 if (er || !current) {
31369 type = getType(current)
31373 props.type = self.type = type
31375 self._old = current
31376 self._addProxy(Writer(props, current))
31380 ProxyWriter.prototype._addProxy = function (proxy) {
31381 // console.error("~~ set proxy", this.path)
31384 return self.error('proxy already set')
31387 self._proxy = proxy
31395 ].forEach(function (ev) {
31396 proxy.on(ev, self.emit.bind(self, ev))
31399 self.emit('proxy', proxy)
31401 var calls = self._buffer
31402 calls.forEach(function (c) {
31403 // console.error("~~ ~~ proxy buffered call", c[0], c[1])
31404 proxy[c[0]].apply(proxy, c[1])
31406 self._buffer.length = 0
31407 if (self._needsDrain) self.emit('drain')
31410 ProxyWriter.prototype.add = function (entry) {
31411 // console.error("~~ proxy add")
31414 if (!this._proxy) {
31415 this._buffer.push(['add', [entry]])
31416 this._needDrain = true
31419 return this._proxy.add(entry)
31422 ProxyWriter.prototype.write = function (c) {
31423 // console.error('~~ proxy write')
31424 if (!this._proxy) {
31425 this._buffer.push(['write', [c]])
31426 this._needDrain = true
31429 return this._proxy.write(c)
31432 ProxyWriter.prototype.end = function (c) {
31433 // console.error('~~ proxy end')
31434 if (!this._proxy) {
31435 this._buffer.push(['end', [c]])
31438 return this._proxy.end(c)
31444 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31446 var fs = __webpack_require__(192);
31447 var Promise = __webpack_require__(128);
31448 var directory = __webpack_require__(212);
31449 var Stream = __webpack_require__(44);
31451 // Backwards compatibility for node versions < 8
31452 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
31453 Stream = __webpack_require__(167);
31456 buffer: function(buffer, options) {
31458 stream: function(offset, length) {
31459 var stream = Stream.PassThrough();
31460 stream.end(buffer.slice(offset, length));
31464 return Promise.resolve(buffer.length);
31467 return directory(source, options);
31469 file: function(filename, options) {
31471 stream: function(offset,length) {
31472 return fs.createReadStream(filename,{start: offset, end: length && offset+length});
31475 return new Promise(function(resolve,reject) {
31476 fs.stat(filename,function(err,d) {
31485 return directory(source, options);
31488 url: function(request, params, options) {
31489 if (typeof params === 'string')
31490 params = {url: params};
31492 throw 'URL missing';
31493 params.headers = params.headers || {};
31496 stream : function(offset,length) {
31497 var options = Object.create(params);
31498 options.headers = Object.create(params.headers);
31499 options.headers.range = 'bytes='+offset+'-' + (length ? length : '');
31500 return request(options);
31503 return new Promise(function(resolve,reject) {
31504 var req = request(params);
31505 req.on('response',function(d) {
31507 if (!d.headers['content-length'])
31508 reject(new Error('Missing content length header'));
31510 resolve(d.headers['content-length']);
31511 }).on('error',reject);
31516 return directory(source, options);
31519 s3 : function(client,params, options) {
31522 return new Promise(function(resolve,reject) {
31523 client.headObject(params, function(err,d) {
31527 resolve(d.ContentLength);
31531 stream: function(offset,length) {
31533 for (var key in params)
31534 d[key] = params[key];
31535 d.Range = 'bytes='+offset+'-' + (length ? length : '');
31536 return client.getObject(d).createReadStream();
31540 return directory(source, options);
31547 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31549 var binary = __webpack_require__(123);
31550 var PullStream = __webpack_require__(164);
31551 var unzip = __webpack_require__(213);
31552 var Promise = __webpack_require__(128);
31553 var BufferStream = __webpack_require__(183);
31554 var parseExtraField = __webpack_require__(184);
31555 var Buffer = __webpack_require__(165);
31556 var path = __webpack_require__(2);
31557 var Writer = __webpack_require__(189).Writer;
31558 var parseDateTime = __webpack_require__(185);
31560 var signature = Buffer.alloc(4);
31561 signature.writeUInt32LE(0x06054b50,0);
31563 function getCrxHeader(source) {
31564 var sourceStream = source.stream(0).pipe(PullStream());
31566 return sourceStream.pull(4).then(function(data) {
31567 var signature = data.readUInt32LE(0);
31568 if (signature === 0x34327243) {
31570 return sourceStream.pull(12).then(function(data) {
31571 crxHeader = binary.parse(data)
31572 .word32lu('version')
31573 .word32lu('pubKeyLength')
31574 .word32lu('signatureLength')
31576 }).then(function() {
31577 return sourceStream.pull(crxHeader.pubKeyLength +crxHeader.signatureLength);
31578 }).then(function(data) {
31579 crxHeader.publicKey = data.slice(0,crxHeader.pubKeyLength);
31580 crxHeader.signature = data.slice(crxHeader.pubKeyLength);
31581 crxHeader.size = 16 + crxHeader.pubKeyLength +crxHeader.signatureLength;
31588 // Zip64 File Format Notes: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
31589 function getZip64CentralDirectory(source, zip64CDL) {
31590 var d64loc = binary.parse(zip64CDL)
31591 .word32lu('signature')
31592 .word32lu('diskNumber')
31593 .word64lu('offsetToStartOfCentralDirectory')
31594 .word32lu('numberOfDisks')
31597 if (d64loc.signature != 0x07064b50) {
31598 throw new Error('invalid zip64 end of central dir locator signature (0x07064b50): 0x' + d64loc.signature.toString(16));
31601 var dir64 = PullStream();
31602 source.stream(d64loc.offsetToStartOfCentralDirectory).pipe(dir64);
31604 return dir64.pull(56)
31607 // Zip64 File Format Notes: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
31608 function parseZip64DirRecord (dir64record) {
31609 var vars = binary.parse(dir64record)
31610 .word32lu('signature')
31611 .word64lu('sizeOfCentralDirectory')
31612 .word16lu('version')
31613 .word16lu('versionsNeededToExtract')
31614 .word32lu('diskNumber')
31615 .word32lu('diskStart')
31616 .word64lu('numberOfRecordsOnDisk')
31617 .word64lu('numberOfRecords')
31618 .word64lu('sizeOfCentralDirectory')
31619 .word64lu('offsetToStartOfCentralDirectory')
31622 if (vars.signature != 0x06064b50) {
31623 throw new Error('invalid zip64 end of central dir locator signature (0x06064b50): 0x0' + vars.signature.toString(16));
31629 module.exports = function centralDirectory(source, options) {
31630 var endDir = PullStream(),
31631 records = PullStream(),
31632 tailSize = (options && options.tailSize) || 80,
31638 if (options && options.crx)
31639 crxHeader = getCrxHeader(source);
31641 return source.size()
31642 .then(function(size) {
31645 source.stream(Math.max(0,size-tailSize))
31646 .on('error', function (error) { endDir.emit('error', error) })
31649 return endDir.pull(signature);
31652 return Promise.props({directory: endDir.pull(22), crxHeader: crxHeader});
31654 .then(function(d) {
31655 var data = d.directory;
31656 startOffset = d.crxHeader && d.crxHeader.size || 0;
31658 vars = binary.parse(data)
31659 .word32lu('signature')
31660 .word16lu('diskNumber')
31661 .word16lu('diskStart')
31662 .word16lu('numberOfRecordsOnDisk')
31663 .word16lu('numberOfRecords')
31664 .word32lu('sizeOfCentralDirectory')
31665 .word32lu('offsetToStartOfCentralDirectory')
31666 .word16lu('commentLength')
31669 // Is this zip file using zip64 format? Use same check as Go:
31670 // https://github.com/golang/go/blob/master/src/archive/zip/reader.go#L503
31671 // For zip64 files, need to find zip64 central directory locator header to extract
31672 // relative offset for zip64 central directory record.
31673 if (vars.numberOfRecords == 0xffff|| vars.numberOfRecords == 0xffff ||
31674 vars.offsetToStartOfCentralDirectory == 0xffffffff) {
31676 // Offset to zip64 CDL is 20 bytes before normal CDR
31677 const zip64CDLSize = 20
31678 const zip64CDLOffset = sourceSize - (tailSize - endDir.match + zip64CDLSize)
31679 const zip64CDLStream = PullStream();
31681 source.stream(zip64CDLOffset).pipe(zip64CDLStream);
31683 return zip64CDLStream.pull(zip64CDLSize)
31684 .then(function (d) { return getZip64CentralDirectory(source, d) })
31685 .then(function (dir64record) {
31686 vars = parseZip64DirRecord(dir64record)
31689 vars.offsetToStartOfCentralDirectory += startOffset;
31693 source.stream(vars.offsetToStartOfCentralDirectory).pipe(records);
31695 vars.extract = function(opts) {
31696 if (!opts || !opts.path) throw new Error('PATH_MISSING');
31697 return vars.files.then(function(files) {
31698 return Promise.map(files, function(entry) {
31699 if (entry.type == 'Directory') return;
31701 // to avoid zip slip (writing outside of the destination), we resolve
31702 // the target path, and make sure it's nested in the intended
31703 // destination, or not extract it otherwise.
31704 var extractPath = path.join(opts.path, entry.path);
31705 if (extractPath.indexOf(opts.path) != 0) {
31708 var writer = opts.getWriter ? opts.getWriter({path: extractPath}) : Writer({ path: extractPath });
31710 return new Promise(function(resolve, reject) {
31711 entry.stream(opts.password)
31712 .on('error',reject)
31714 .on('close',resolve)
31715 .on('error',reject);
31717 }, opts.concurrency > 1 ? {concurrency: opts.concurrency || undefined} : undefined);
31721 vars.files = Promise.mapSeries(Array(vars.numberOfRecords),function() {
31722 return records.pull(46).then(function(data) {
31723 var vars = binary.parse(data)
31724 .word32lu('signature')
31725 .word16lu('versionMadeBy')
31726 .word16lu('versionsNeededToExtract')
31728 .word16lu('compressionMethod')
31729 .word16lu('lastModifiedTime')
31730 .word16lu('lastModifiedDate')
31732 .word32lu('compressedSize')
31733 .word32lu('uncompressedSize')
31734 .word16lu('fileNameLength')
31735 .word16lu('extraFieldLength')
31736 .word16lu('fileCommentLength')
31737 .word16lu('diskNumber')
31738 .word16lu('internalFileAttributes')
31739 .word32lu('externalFileAttributes')
31740 .word32lu('offsetToLocalFileHeader')
31743 vars.offsetToLocalFileHeader += startOffset;
31744 vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
31746 return records.pull(vars.fileNameLength).then(function(fileNameBuffer) {
31747 vars.pathBuffer = fileNameBuffer;
31748 vars.path = fileNameBuffer.toString('utf8');
31749 vars.isUnicode = vars.flags & 0x11;
31750 return records.pull(vars.extraFieldLength);
31752 .then(function(extraField) {
31753 vars.extra = parseExtraField(extraField, vars);
31754 return records.pull(vars.fileCommentLength);
31756 .then(function(comment) {
31757 vars.comment = comment;
31758 vars.type = (vars.uncompressedSize === 0 && /[\/\\]$/.test(vars.path)) ? 'Directory' : 'File';
31759 vars.stream = function(_password) {
31760 return unzip(source, vars.offsetToLocalFileHeader,_password, vars);
31762 vars.buffer = function(_password) {
31763 return BufferStream(vars.stream(_password));
31770 return Promise.props(vars);
31777 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31779 var Promise = __webpack_require__(128);
31780 var Decrypt = __webpack_require__(214);
31781 var PullStream = __webpack_require__(164);
31782 var Stream = __webpack_require__(44);
31783 var binary = __webpack_require__(123);
31784 var zlib = __webpack_require__(48);
31785 var parseExtraField = __webpack_require__(184);
31786 var Buffer = __webpack_require__(165);
31787 var parseDateTime = __webpack_require__(185);
31789 // Backwards compatibility for node versions < 8
31790 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
31791 Stream = __webpack_require__(167);
31793 module.exports = function unzip(source,offset,_password, directoryVars) {
31794 var file = PullStream(),
31795 entry = Stream.PassThrough();
31797 var req = source.stream(offset);
31798 req.pipe(file).on('error', function(e) {
31799 entry.emit('error', e);
31802 entry.vars = file.pull(30)
31803 .then(function(data) {
31804 var vars = binary.parse(data)
31805 .word32lu('signature')
31806 .word16lu('versionsNeededToExtract')
31808 .word16lu('compressionMethod')
31809 .word16lu('lastModifiedTime')
31810 .word16lu('lastModifiedDate')
31812 .word32lu('compressedSize')
31813 .word32lu('uncompressedSize')
31814 .word16lu('fileNameLength')
31815 .word16lu('extraFieldLength')
31818 vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
31820 return file.pull(vars.fileNameLength)
31821 .then(function(fileName) {
31822 vars.fileName = fileName.toString('utf8');
31823 return file.pull(vars.extraFieldLength);
31825 .then(function(extraField) {
31826 var checkEncryption;
31827 vars.extra = parseExtraField(extraField, vars);
31828 // Ignore logal file header vars if the directory vars are available
31829 if (directoryVars && directoryVars.compressedSize) vars = directoryVars;
31831 if (vars.flags & 0x01) checkEncryption = file.pull(12)
31832 .then(function(header) {
31834 throw new Error('MISSING_PASSWORD');
31836 var decrypt = Decrypt();
31838 String(_password).split('').forEach(function(d) {
31842 for (var i=0; i < header.length; i++)
31843 header[i] = decrypt.decryptByte(header[i]);
31845 vars.decrypt = decrypt;
31846 vars.compressedSize -= 12;
31848 var check = (vars.flags & 0x8) ? (vars.lastModifiedTime >> 8) & 0xff : (vars.crc32 >> 24) & 0xff;
31849 if (header[11] !== check)
31850 throw new Error('BAD_PASSWORD');
31855 return Promise.resolve(checkEncryption)
31857 entry.emit('vars',vars);
31863 entry.vars.then(function(vars) {
31864 var fileSizeKnown = !(vars.flags & 0x08) || vars.compressedSize > 0,
31867 var inflater = vars.compressionMethod ? zlib.createInflateRaw() : Stream.PassThrough();
31869 if (fileSizeKnown) {
31870 entry.size = vars.uncompressedSize;
31871 eof = vars.compressedSize;
31873 eof = Buffer.alloc(4);
31874 eof.writeUInt32LE(0x08074b50, 0);
31877 var stream = file.stream(eof);
31880 stream = stream.pipe(vars.decrypt.stream());
31884 .on('error',function(err) { entry.emit('error',err);})
31886 .on('finish', function() {
31889 else if (req.close)
31894 console.log('warning - unable to close stream');
31897 .catch(function(e) {
31898 entry.emit('error',e);
31907 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31909 var bigInt = __webpack_require__(215);
31910 var Stream = __webpack_require__(44);
31912 // Backwards compatibility for node versions < 8
31913 if (!Stream.Writable || !Stream.Writable.prototype.destroy)
31914 Stream = __webpack_require__(167);
31918 function generateTable() {
31919 var poly = 0xEDB88320,c,n,k;
31921 for (n = 0; n < 256; n++) {
31923 for (k = 0; k < 8; k++)
31924 c = (c & 1) ? poly ^ (c >>> 1) : c = c >>> 1;
31925 table[n] = c >>> 0;
31929 function crc(ch,crc) {
31934 ch = ch.charCodeAt(0);
31936 return (bigInt(crc).shiftRight(8).and(0xffffff)).xor(table[bigInt(crc).xor(ch).and(0xff)]).value;
31939 function Decrypt() {
31940 if (!(this instanceof Decrypt))
31941 return new Decrypt();
31943 this.key0 = 305419896;
31944 this.key1 = 591751049;
31945 this.key2 = 878082192;
31948 Decrypt.prototype.update = function(h) {
31949 this.key0 = crc(h,this.key0);
31950 this.key1 = bigInt(this.key0).and(255).and(4294967295).add(this.key1)
31951 this.key1 = bigInt(this.key1).multiply(134775813).add(1).and(4294967295).value;
31952 this.key2 = crc(bigInt(this.key1).shiftRight(24).and(255), this.key2);
31956 Decrypt.prototype.decryptByte = function(c) {
31957 var k = bigInt(this.key2).or(2);
31958 c = c ^ bigInt(k).multiply(bigInt(k^1)).shiftRight(8).and(255);
31963 Decrypt.prototype.stream = function() {
31964 var stream = Stream.Transform(),
31967 stream._transform = function(d,e,cb) {
31968 for (var i = 0; i<d.length;i++) {
31969 d[i] = self.decryptByte(d[i]);
31980 module.exports = Decrypt;
31984 /***/ ((module, exports, __webpack_require__) => {
31986 /* module decorator */ module = __webpack_require__.nmd(module);
31987 var __WEBPACK_AMD_DEFINE_RESULT__;var bigInt = (function (undefined) {
\r
31992 MAX_INT = 9007199254740992,
\r
31993 MAX_INT_ARR = smallToArray(MAX_INT),
\r
31994 DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
\r
31996 var supportsNativeBigInt = typeof BigInt === "function";
\r
31998 function Integer(v, radix, alphabet, caseSensitive) {
\r
31999 if (typeof v === "undefined") return Integer[0];
\r
32000 if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);
\r
32001 return parseValue(v);
\r
32004 function BigInteger(value, sign) {
\r
32005 this.value = value;
\r
32006 this.sign = sign;
\r
32007 this.isSmall = false;
\r
32009 BigInteger.prototype = Object.create(Integer.prototype);
\r
32011 function SmallInteger(value) {
\r
32012 this.value = value;
\r
32013 this.sign = value < 0;
\r
32014 this.isSmall = true;
\r
32016 SmallInteger.prototype = Object.create(Integer.prototype);
\r
32018 function NativeBigInt(value) {
\r
32019 this.value = value;
\r
32021 NativeBigInt.prototype = Object.create(Integer.prototype);
\r
32023 function isPrecise(n) {
\r
32024 return -MAX_INT < n && n < MAX_INT;
\r
32027 function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes
\r
32031 return [n % 1e7, Math.floor(n / 1e7)];
\r
32032 return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];
\r
32035 function arrayToSmall(arr) { // If BASE changes this function may need to change
\r
32037 var length = arr.length;
\r
32038 if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {
\r
32039 switch (length) {
\r
32040 case 0: return 0;
\r
32041 case 1: return arr[0];
\r
32042 case 2: return arr[0] + arr[1] * BASE;
\r
32043 default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE;
\r
32049 function trim(v) {
\r
32050 var i = v.length;
\r
32051 while (v[--i] === 0);
\r
32052 v.length = i + 1;
\r
32055 function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger
\r
32056 var x = new Array(length);
\r
32058 while (++i < length) {
\r
32064 function truncate(n) {
\r
32065 if (n > 0) return Math.floor(n);
\r
32066 return Math.ceil(n);
\r
32069 function add(a, b) { // assumes a and b are arrays with a.length >= b.length
\r
32070 var l_a = a.length,
\r
32072 r = new Array(l_a),
\r
32076 for (i = 0; i < l_b; i++) {
\r
32077 sum = a[i] + b[i] + carry;
\r
32078 carry = sum >= base ? 1 : 0;
\r
32079 r[i] = sum - carry * base;
\r
32081 while (i < l_a) {
\r
32082 sum = a[i] + carry;
\r
32083 carry = sum === base ? 1 : 0;
\r
32084 r[i++] = sum - carry * base;
\r
32086 if (carry > 0) r.push(carry);
\r
32090 function addAny(a, b) {
\r
32091 if (a.length >= b.length) return add(a, b);
\r
32092 return add(b, a);
\r
32095 function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT
\r
32096 var l = a.length,
\r
32097 r = new Array(l),
\r
32100 for (i = 0; i < l; i++) {
\r
32101 sum = a[i] - base + carry;
\r
32102 carry = Math.floor(sum / base);
\r
32103 r[i] = sum - carry * base;
\r
32106 while (carry > 0) {
\r
32107 r[i++] = carry % base;
\r
32108 carry = Math.floor(carry / base);
\r
32113 BigInteger.prototype.add = function (v) {
\r
32114 var n = parseValue(v);
\r
32115 if (this.sign !== n.sign) {
\r
32116 return this.subtract(n.negate());
\r
32118 var a = this.value, b = n.value;
\r
32120 return new BigInteger(addSmall(a, Math.abs(b)), this.sign);
\r
32122 return new BigInteger(addAny(a, b), this.sign);
\r
32124 BigInteger.prototype.plus = BigInteger.prototype.add;
\r
32126 SmallInteger.prototype.add = function (v) {
\r
32127 var n = parseValue(v);
\r
32128 var a = this.value;
\r
32129 if (a < 0 !== n.sign) {
\r
32130 return this.subtract(n.negate());
\r
32134 if (isPrecise(a + b)) return new SmallInteger(a + b);
\r
32135 b = smallToArray(Math.abs(b));
\r
32137 return new BigInteger(addSmall(b, Math.abs(a)), a < 0);
\r
32139 SmallInteger.prototype.plus = SmallInteger.prototype.add;
\r
32141 NativeBigInt.prototype.add = function (v) {
\r
32142 return new NativeBigInt(this.value + parseValue(v).value);
\r
32144 NativeBigInt.prototype.plus = NativeBigInt.prototype.add;
\r
32146 function subtract(a, b) { // assumes a and b are arrays with a >= b
\r
32147 var a_l = a.length,
\r
32149 r = new Array(a_l),
\r
32153 for (i = 0; i < b_l; i++) {
\r
32154 difference = a[i] - borrow - b[i];
\r
32155 if (difference < 0) {
\r
32156 difference += base;
\r
32158 } else borrow = 0;
\r
32159 r[i] = difference;
\r
32161 for (i = b_l; i < a_l; i++) {
\r
32162 difference = a[i] - borrow;
\r
32163 if (difference < 0) difference += base;
\r
32165 r[i++] = difference;
\r
32168 r[i] = difference;
\r
32170 for (; i < a_l; i++) {
\r
32177 function subtractAny(a, b, sign) {
\r
32179 if (compareAbs(a, b) >= 0) {
\r
32180 value = subtract(a, b);
\r
32182 value = subtract(b, a);
\r
32185 value = arrayToSmall(value);
\r
32186 if (typeof value === "number") {
\r
32187 if (sign) value = -value;
\r
32188 return new SmallInteger(value);
\r
32190 return new BigInteger(value, sign);
\r
32193 function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT
\r
32194 var l = a.length,
\r
32195 r = new Array(l),
\r
32199 for (i = 0; i < l; i++) {
\r
32200 difference = a[i] + carry;
\r
32201 carry = Math.floor(difference / base);
\r
32202 difference %= base;
\r
32203 r[i] = difference < 0 ? difference + base : difference;
\r
32205 r = arrayToSmall(r);
\r
32206 if (typeof r === "number") {
\r
32207 if (sign) r = -r;
\r
32208 return new SmallInteger(r);
\r
32209 } return new BigInteger(r, sign);
\r
32212 BigInteger.prototype.subtract = function (v) {
\r
32213 var n = parseValue(v);
\r
32214 if (this.sign !== n.sign) {
\r
32215 return this.add(n.negate());
\r
32217 var a = this.value, b = n.value;
\r
32219 return subtractSmall(a, Math.abs(b), this.sign);
\r
32220 return subtractAny(a, b, this.sign);
\r
32222 BigInteger.prototype.minus = BigInteger.prototype.subtract;
\r
32224 SmallInteger.prototype.subtract = function (v) {
\r
32225 var n = parseValue(v);
\r
32226 var a = this.value;
\r
32227 if (a < 0 !== n.sign) {
\r
32228 return this.add(n.negate());
\r
32232 return new SmallInteger(a - b);
\r
32234 return subtractSmall(b, Math.abs(a), a >= 0);
\r
32236 SmallInteger.prototype.minus = SmallInteger.prototype.subtract;
\r
32238 NativeBigInt.prototype.subtract = function (v) {
\r
32239 return new NativeBigInt(this.value - parseValue(v).value);
\r
32241 NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;
\r
32243 BigInteger.prototype.negate = function () {
\r
32244 return new BigInteger(this.value, !this.sign);
\r
32246 SmallInteger.prototype.negate = function () {
\r
32247 var sign = this.sign;
\r
32248 var small = new SmallInteger(-this.value);
\r
32249 small.sign = !sign;
\r
32252 NativeBigInt.prototype.negate = function () {
\r
32253 return new NativeBigInt(-this.value);
\r
32256 BigInteger.prototype.abs = function () {
\r
32257 return new BigInteger(this.value, false);
\r
32259 SmallInteger.prototype.abs = function () {
\r
32260 return new SmallInteger(Math.abs(this.value));
\r
32262 NativeBigInt.prototype.abs = function () {
\r
32263 return new NativeBigInt(this.value >= 0 ? this.value : -this.value);
\r
32267 function multiplyLong(a, b) {
\r
32268 var a_l = a.length,
\r
32271 r = createArray(l),
\r
32273 product, carry, i, a_i, b_j;
\r
32274 for (i = 0; i < a_l; ++i) {
\r
32276 for (var j = 0; j < b_l; ++j) {
\r
32278 product = a_i * b_j + r[i + j];
\r
32279 carry = Math.floor(product / base);
\r
32280 r[i + j] = product - carry * base;
\r
32281 r[i + j + 1] += carry;
\r
32288 function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE
\r
32289 var l = a.length,
\r
32290 r = new Array(l),
\r
32294 for (i = 0; i < l; i++) {
\r
32295 product = a[i] * b + carry;
\r
32296 carry = Math.floor(product / base);
\r
32297 r[i] = product - carry * base;
\r
32299 while (carry > 0) {
\r
32300 r[i++] = carry % base;
\r
32301 carry = Math.floor(carry / base);
\r
32306 function shiftLeft(x, n) {
\r
32308 while (n-- > 0) r.push(0);
\r
32309 return r.concat(x);
\r
32312 function multiplyKaratsuba(x, y) {
\r
32313 var n = Math.max(x.length, y.length);
\r
32315 if (n <= 30) return multiplyLong(x, y);
\r
32316 n = Math.ceil(n / 2);
\r
32318 var b = x.slice(n),
\r
32319 a = x.slice(0, n),
\r
32321 c = y.slice(0, n);
\r
32323 var ac = multiplyKaratsuba(a, c),
\r
32324 bd = multiplyKaratsuba(b, d),
\r
32325 abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));
\r
32327 var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));
\r
32332 // The following function is derived from a surface fit of a graph plotting the performance difference
\r
32333 // between long multiplication and karatsuba multiplication versus the lengths of the two arrays.
\r
32334 function useKaratsuba(l1, l2) {
\r
32335 return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0;
\r
32338 BigInteger.prototype.multiply = function (v) {
\r
32339 var n = parseValue(v),
\r
32340 a = this.value, b = n.value,
\r
32341 sign = this.sign !== n.sign,
\r
32344 if (b === 0) return Integer[0];
\r
32345 if (b === 1) return this;
\r
32346 if (b === -1) return this.negate();
\r
32347 abs = Math.abs(b);
\r
32348 if (abs < BASE) {
\r
32349 return new BigInteger(multiplySmall(a, abs), sign);
\r
32351 b = smallToArray(abs);
\r
32353 if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes
\r
32354 return new BigInteger(multiplyKaratsuba(a, b), sign);
\r
32355 return new BigInteger(multiplyLong(a, b), sign);
\r
32358 BigInteger.prototype.times = BigInteger.prototype.multiply;
\r
32360 function multiplySmallAndArray(a, b, sign) { // a >= 0
\r
32362 return new BigInteger(multiplySmall(b, a), sign);
\r
32364 return new BigInteger(multiplyLong(b, smallToArray(a)), sign);
\r
32366 SmallInteger.prototype._multiplyBySmall = function (a) {
\r
32367 if (isPrecise(a.value * this.value)) {
\r
32368 return new SmallInteger(a.value * this.value);
\r
32370 return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);
\r
32372 BigInteger.prototype._multiplyBySmall = function (a) {
\r
32373 if (a.value === 0) return Integer[0];
\r
32374 if (a.value === 1) return this;
\r
32375 if (a.value === -1) return this.negate();
\r
32376 return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);
\r
32378 SmallInteger.prototype.multiply = function (v) {
\r
32379 return parseValue(v)._multiplyBySmall(this);
\r
32381 SmallInteger.prototype.times = SmallInteger.prototype.multiply;
\r
32383 NativeBigInt.prototype.multiply = function (v) {
\r
32384 return new NativeBigInt(this.value * parseValue(v).value);
\r
32386 NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;
\r
32388 function square(a) {
\r
32389 //console.assert(2 * BASE * BASE < MAX_INT);
\r
32390 var l = a.length,
\r
32391 r = createArray(l + l),
\r
32393 product, carry, i, a_i, a_j;
\r
32394 for (i = 0; i < l; i++) {
\r
32396 carry = 0 - a_i * a_i;
\r
32397 for (var j = i; j < l; j++) {
\r
32399 product = 2 * (a_i * a_j) + r[i + j] + carry;
\r
32400 carry = Math.floor(product / base);
\r
32401 r[i + j] = product - carry * base;
\r
32403 r[i + l] = carry;
\r
32409 BigInteger.prototype.square = function () {
\r
32410 return new BigInteger(square(this.value), false);
\r
32413 SmallInteger.prototype.square = function () {
\r
32414 var value = this.value * this.value;
\r
32415 if (isPrecise(value)) return new SmallInteger(value);
\r
32416 return new BigInteger(square(smallToArray(Math.abs(this.value))), false);
\r
32419 NativeBigInt.prototype.square = function (v) {
\r
32420 return new NativeBigInt(this.value * this.value);
\r
32423 function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes.
\r
32424 var a_l = a.length,
\r
32427 result = createArray(b.length),
\r
32428 divisorMostSignificantDigit = b[b_l - 1],
\r
32430 lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),
\r
32431 remainder = multiplySmall(a, lambda),
\r
32432 divisor = multiplySmall(b, lambda),
\r
32433 quotientDigit, shift, carry, borrow, i, l, q;
\r
32434 if (remainder.length <= a_l) remainder.push(0);
\r
32436 divisorMostSignificantDigit = divisor[b_l - 1];
\r
32437 for (shift = a_l - b_l; shift >= 0; shift--) {
\r
32438 quotientDigit = base - 1;
\r
32439 if (remainder[shift + b_l] !== divisorMostSignificantDigit) {
\r
32440 quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);
\r
32442 // quotientDigit <= base - 1
\r
32445 l = divisor.length;
\r
32446 for (i = 0; i < l; i++) {
\r
32447 carry += quotientDigit * divisor[i];
\r
32448 q = Math.floor(carry / base);
\r
32449 borrow += remainder[shift + i] - (carry - q * base);
\r
32451 if (borrow < 0) {
\r
32452 remainder[shift + i] = borrow + base;
\r
32455 remainder[shift + i] = borrow;
\r
32459 while (borrow !== 0) {
\r
32460 quotientDigit -= 1;
\r
32462 for (i = 0; i < l; i++) {
\r
32463 carry += remainder[shift + i] - base + divisor[i];
\r
32465 remainder[shift + i] = carry + base;
\r
32468 remainder[shift + i] = carry;
\r
32474 result[shift] = quotientDigit;
\r
32476 // denormalization
\r
32477 remainder = divModSmall(remainder, lambda)[0];
\r
32478 return [arrayToSmall(result), arrayToSmall(remainder)];
\r
32481 function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/
\r
32482 // Performs faster than divMod1 on larger input sizes.
\r
32483 var a_l = a.length,
\r
32488 guess, xlen, highx, highy, check;
\r
32490 part.unshift(a[--a_l]);
\r
32492 if (compareAbs(part, b) < 0) {
\r
32496 xlen = part.length;
\r
32497 highx = part[xlen - 1] * base + part[xlen - 2];
\r
32498 highy = b[b_l - 1] * base + b[b_l - 2];
\r
32499 if (xlen > b_l) {
\r
32500 highx = (highx + 1) * base;
\r
32502 guess = Math.ceil(highx / highy);
\r
32504 check = multiplySmall(b, guess);
\r
32505 if (compareAbs(check, part) <= 0) break;
\r
32508 result.push(guess);
\r
32509 part = subtract(part, check);
\r
32511 result.reverse();
\r
32512 return [arrayToSmall(result), arrayToSmall(part)];
\r
32515 function divModSmall(value, lambda) {
\r
32516 var length = value.length,
\r
32517 quotient = createArray(length),
\r
32519 i, q, remainder, divisor;
\r
32521 for (i = length - 1; i >= 0; --i) {
\r
32522 divisor = remainder * base + value[i];
\r
32523 q = truncate(divisor / lambda);
\r
32524 remainder = divisor - q * lambda;
\r
32525 quotient[i] = q | 0;
\r
32527 return [quotient, remainder | 0];
\r
32530 function divModAny(self, v) {
\r
32531 var value, n = parseValue(v);
\r
32532 if (supportsNativeBigInt) {
\r
32533 return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)];
\r
32535 var a = self.value, b = n.value;
\r
32537 if (b === 0) throw new Error("Cannot divide by zero");
\r
32538 if (self.isSmall) {
\r
32540 return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];
\r
32542 return [Integer[0], self];
\r
32545 if (b === 1) return [self, Integer[0]];
\r
32546 if (b == -1) return [self.negate(), Integer[0]];
\r
32547 var abs = Math.abs(b);
\r
32548 if (abs < BASE) {
\r
32549 value = divModSmall(a, abs);
\r
32550 quotient = arrayToSmall(value[0]);
\r
32551 var remainder = value[1];
\r
32552 if (self.sign) remainder = -remainder;
\r
32553 if (typeof quotient === "number") {
\r
32554 if (self.sign !== n.sign) quotient = -quotient;
\r
32555 return [new SmallInteger(quotient), new SmallInteger(remainder)];
\r
32557 return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];
\r
32559 b = smallToArray(abs);
\r
32561 var comparison = compareAbs(a, b);
\r
32562 if (comparison === -1) return [Integer[0], self];
\r
32563 if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];
\r
32565 // divMod1 is faster on smaller input sizes
\r
32566 if (a.length + b.length <= 200)
\r
32567 value = divMod1(a, b);
\r
32568 else value = divMod2(a, b);
\r
32570 quotient = value[0];
\r
32571 var qSign = self.sign !== n.sign,
\r
32573 mSign = self.sign;
\r
32574 if (typeof quotient === "number") {
\r
32575 if (qSign) quotient = -quotient;
\r
32576 quotient = new SmallInteger(quotient);
\r
32577 } else quotient = new BigInteger(quotient, qSign);
\r
32578 if (typeof mod === "number") {
\r
32579 if (mSign) mod = -mod;
\r
32580 mod = new SmallInteger(mod);
\r
32581 } else mod = new BigInteger(mod, mSign);
\r
32582 return [quotient, mod];
\r
32585 BigInteger.prototype.divmod = function (v) {
\r
32586 var result = divModAny(this, v);
\r
32588 quotient: result[0],
\r
32589 remainder: result[1]
\r
32592 NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;
\r
32595 BigInteger.prototype.divide = function (v) {
\r
32596 return divModAny(this, v)[0];
\r
32598 NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) {
\r
32599 return new NativeBigInt(this.value / parseValue(v).value);
\r
32601 SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;
\r
32603 BigInteger.prototype.mod = function (v) {
\r
32604 return divModAny(this, v)[1];
\r
32606 NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) {
\r
32607 return new NativeBigInt(this.value % parseValue(v).value);
\r
32609 SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;
\r
32611 BigInteger.prototype.pow = function (v) {
\r
32612 var n = parseValue(v),
\r
32616 if (b === 0) return Integer[1];
\r
32617 if (a === 0) return Integer[0];
\r
32618 if (a === 1) return Integer[1];
\r
32619 if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];
\r
32621 return Integer[0];
\r
32623 if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large.");
\r
32624 if (this.isSmall) {
\r
32625 if (isPrecise(value = Math.pow(a, b)))
\r
32626 return new SmallInteger(truncate(value));
\r
32631 if (b & 1 === 1) {
\r
32635 if (b === 0) break;
\r
32641 SmallInteger.prototype.pow = BigInteger.prototype.pow;
\r
32643 NativeBigInt.prototype.pow = function (v) {
\r
32644 var n = parseValue(v);
\r
32645 var a = this.value, b = n.value;
\r
32646 var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);
\r
32647 if (b === _0) return Integer[1];
\r
32648 if (a === _0) return Integer[0];
\r
32649 if (a === _1) return Integer[1];
\r
32650 if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1];
\r
32651 if (n.isNegative()) return new NativeBigInt(_0);
\r
32653 var y = Integer[1];
\r
32655 if ((b & _1) === _1) {
\r
32659 if (b === _0) break;
\r
32666 BigInteger.prototype.modPow = function (exp, mod) {
\r
32667 exp = parseValue(exp);
\r
32668 mod = parseValue(mod);
\r
32669 if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0");
\r
32670 var r = Integer[1],
\r
32671 base = this.mod(mod);
\r
32672 if (exp.isNegative()) {
\r
32673 exp = exp.multiply(Integer[-1]);
\r
32674 base = base.modInv(mod);
\r
32676 while (exp.isPositive()) {
\r
32677 if (base.isZero()) return Integer[0];
\r
32678 if (exp.isOdd()) r = r.multiply(base).mod(mod);
\r
32679 exp = exp.divide(2);
\r
32680 base = base.square().mod(mod);
\r
32684 NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;
\r
32686 function compareAbs(a, b) {
\r
32687 if (a.length !== b.length) {
\r
32688 return a.length > b.length ? 1 : -1;
\r
32690 for (var i = a.length - 1; i >= 0; i--) {
\r
32691 if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;
\r
32696 BigInteger.prototype.compareAbs = function (v) {
\r
32697 var n = parseValue(v),
\r
32700 if (n.isSmall) return 1;
\r
32701 return compareAbs(a, b);
\r
32703 SmallInteger.prototype.compareAbs = function (v) {
\r
32704 var n = parseValue(v),
\r
32705 a = Math.abs(this.value),
\r
32709 return a === b ? 0 : a > b ? 1 : -1;
\r
32713 NativeBigInt.prototype.compareAbs = function (v) {
\r
32714 var a = this.value;
\r
32715 var b = parseValue(v).value;
\r
32716 a = a >= 0 ? a : -a;
\r
32717 b = b >= 0 ? b : -b;
\r
32718 return a === b ? 0 : a > b ? 1 : -1;
\r
32721 BigInteger.prototype.compare = function (v) {
\r
32722 // See discussion about comparison with Infinity:
\r
32723 // https://github.com/peterolson/BigInteger.js/issues/61
\r
32724 if (v === Infinity) {
\r
32727 if (v === -Infinity) {
\r
32731 var n = parseValue(v),
\r
32734 if (this.sign !== n.sign) {
\r
32735 return n.sign ? 1 : -1;
\r
32738 return this.sign ? -1 : 1;
\r
32740 return compareAbs(a, b) * (this.sign ? -1 : 1);
\r
32742 BigInteger.prototype.compareTo = BigInteger.prototype.compare;
\r
32744 SmallInteger.prototype.compare = function (v) {
\r
32745 if (v === Infinity) {
\r
32748 if (v === -Infinity) {
\r
32752 var n = parseValue(v),
\r
32756 return a == b ? 0 : a > b ? 1 : -1;
\r
32758 if (a < 0 !== n.sign) {
\r
32759 return a < 0 ? -1 : 1;
\r
32761 return a < 0 ? 1 : -1;
\r
32763 SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;
\r
32765 NativeBigInt.prototype.compare = function (v) {
\r
32766 if (v === Infinity) {
\r
32769 if (v === -Infinity) {
\r
32772 var a = this.value;
\r
32773 var b = parseValue(v).value;
\r
32774 return a === b ? 0 : a > b ? 1 : -1;
\r
32776 NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;
\r
32778 BigInteger.prototype.equals = function (v) {
\r
32779 return this.compare(v) === 0;
\r
32781 NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;
\r
32783 BigInteger.prototype.notEquals = function (v) {
\r
32784 return this.compare(v) !== 0;
\r
32786 NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;
\r
32788 BigInteger.prototype.greater = function (v) {
\r
32789 return this.compare(v) > 0;
\r
32791 NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;
\r
32793 BigInteger.prototype.lesser = function (v) {
\r
32794 return this.compare(v) < 0;
\r
32796 NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;
\r
32798 BigInteger.prototype.greaterOrEquals = function (v) {
\r
32799 return this.compare(v) >= 0;
\r
32801 NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;
\r
32803 BigInteger.prototype.lesserOrEquals = function (v) {
\r
32804 return this.compare(v) <= 0;
\r
32806 NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;
\r
32808 BigInteger.prototype.isEven = function () {
\r
32809 return (this.value[0] & 1) === 0;
\r
32811 SmallInteger.prototype.isEven = function () {
\r
32812 return (this.value & 1) === 0;
\r
32814 NativeBigInt.prototype.isEven = function () {
\r
32815 return (this.value & BigInt(1)) === BigInt(0);
\r
32818 BigInteger.prototype.isOdd = function () {
\r
32819 return (this.value[0] & 1) === 1;
\r
32821 SmallInteger.prototype.isOdd = function () {
\r
32822 return (this.value & 1) === 1;
\r
32824 NativeBigInt.prototype.isOdd = function () {
\r
32825 return (this.value & BigInt(1)) === BigInt(1);
\r
32828 BigInteger.prototype.isPositive = function () {
\r
32829 return !this.sign;
\r
32831 SmallInteger.prototype.isPositive = function () {
\r
32832 return this.value > 0;
\r
32834 NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;
\r
32836 BigInteger.prototype.isNegative = function () {
\r
32837 return this.sign;
\r
32839 SmallInteger.prototype.isNegative = function () {
\r
32840 return this.value < 0;
\r
32842 NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;
\r
32844 BigInteger.prototype.isUnit = function () {
\r
32847 SmallInteger.prototype.isUnit = function () {
\r
32848 return Math.abs(this.value) === 1;
\r
32850 NativeBigInt.prototype.isUnit = function () {
\r
32851 return this.abs().value === BigInt(1);
\r
32854 BigInteger.prototype.isZero = function () {
\r
32857 SmallInteger.prototype.isZero = function () {
\r
32858 return this.value === 0;
\r
32860 NativeBigInt.prototype.isZero = function () {
\r
32861 return this.value === BigInt(0);
\r
32864 BigInteger.prototype.isDivisibleBy = function (v) {
\r
32865 var n = parseValue(v);
\r
32866 if (n.isZero()) return false;
\r
32867 if (n.isUnit()) return true;
\r
32868 if (n.compareAbs(2) === 0) return this.isEven();
\r
32869 return this.mod(n).isZero();
\r
32871 NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;
\r
32873 function isBasicPrime(v) {
\r
32875 if (n.isUnit()) return false;
\r
32876 if (n.equals(2) || n.equals(3) || n.equals(5)) return true;
\r
32877 if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;
\r
32878 if (n.lesser(49)) return true;
\r
32879 // we don't know if it's prime: let the other functions figure it out
\r
32882 function millerRabinTest(n, a) {
\r
32883 var nPrev = n.prev(),
\r
32887 while (b.isEven()) b = b.divide(2), r++;
\r
32888 next: for (i = 0; i < a.length; i++) {
\r
32889 if (n.lesser(a[i])) continue;
\r
32890 x = bigInt(a[i]).modPow(b, n);
\r
32891 if (x.isUnit() || x.equals(nPrev)) continue;
\r
32892 for (d = r - 1; d != 0; d--) {
\r
32893 x = x.square().mod(n);
\r
32894 if (x.isUnit()) return false;
\r
32895 if (x.equals(nPrev)) continue next;
\r
32902 // Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2
\r
32903 BigInteger.prototype.isPrime = function (strict) {
\r
32904 var isPrime = isBasicPrime(this);
\r
32905 if (isPrime !== undefined) return isPrime;
\r
32906 var n = this.abs();
\r
32907 var bits = n.bitLength();
\r
32909 return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
\r
32910 var logN = Math.log(2) * bits.toJSNumber();
\r
32911 var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);
\r
32912 for (var a = [], i = 0; i < t; i++) {
\r
32913 a.push(bigInt(i + 2));
\r
32915 return millerRabinTest(n, a);
\r
32917 NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
\r
32919 BigInteger.prototype.isProbablePrime = function (iterations, rng) {
\r
32920 var isPrime = isBasicPrime(this);
\r
32921 if (isPrime !== undefined) return isPrime;
\r
32922 var n = this.abs();
\r
32923 var t = iterations === undefined ? 5 : iterations;
\r
32924 for (var a = [], i = 0; i < t; i++) {
\r
32925 a.push(bigInt.randBetween(2, n.minus(2), rng));
\r
32927 return millerRabinTest(n, a);
\r
32929 NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
\r
32931 BigInteger.prototype.modInv = function (n) {
\r
32932 var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
\r
32933 while (!newR.isZero()) {
\r
32934 q = r.divide(newR);
\r
32939 newT = lastT.subtract(q.multiply(newT));
\r
32940 newR = lastR.subtract(q.multiply(newR));
\r
32942 if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
\r
32943 if (t.compare(0) === -1) {
\r
32946 if (this.isNegative()) {
\r
32947 return t.negate();
\r
32952 NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
\r
32954 BigInteger.prototype.next = function () {
\r
32955 var value = this.value;
\r
32957 return subtractSmall(value, 1, this.sign);
\r
32959 return new BigInteger(addSmall(value, 1), this.sign);
\r
32961 SmallInteger.prototype.next = function () {
\r
32962 var value = this.value;
\r
32963 if (value + 1 < MAX_INT) return new SmallInteger(value + 1);
\r
32964 return new BigInteger(MAX_INT_ARR, false);
\r
32966 NativeBigInt.prototype.next = function () {
\r
32967 return new NativeBigInt(this.value + BigInt(1));
\r
32970 BigInteger.prototype.prev = function () {
\r
32971 var value = this.value;
\r
32973 return new BigInteger(addSmall(value, 1), true);
\r
32975 return subtractSmall(value, 1, this.sign);
\r
32977 SmallInteger.prototype.prev = function () {
\r
32978 var value = this.value;
\r
32979 if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);
\r
32980 return new BigInteger(MAX_INT_ARR, true);
\r
32982 NativeBigInt.prototype.prev = function () {
\r
32983 return new NativeBigInt(this.value - BigInt(1));
\r
32986 var powersOfTwo = [1];
\r
32987 while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
\r
32988 var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
\r
32990 function shift_isSmall(n) {
\r
32991 return Math.abs(n) <= BASE;
\r
32994 BigInteger.prototype.shiftLeft = function (v) {
\r
32995 var n = parseValue(v).toJSNumber();
\r
32996 if (!shift_isSmall(n)) {
\r
32997 throw new Error(String(n) + " is too large for shifting.");
\r
32999 if (n < 0) return this.shiftRight(-n);
\r
33000 var result = this;
\r
33001 if (result.isZero()) return result;
\r
33002 while (n >= powers2Length) {
\r
33003 result = result.multiply(highestPower2);
\r
33004 n -= powers2Length - 1;
\r
33006 return result.multiply(powersOfTwo[n]);
\r
33008 NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;
\r
33010 BigInteger.prototype.shiftRight = function (v) {
\r
33012 var n = parseValue(v).toJSNumber();
\r
33013 if (!shift_isSmall(n)) {
\r
33014 throw new Error(String(n) + " is too large for shifting.");
\r
33016 if (n < 0) return this.shiftLeft(-n);
\r
33017 var result = this;
\r
33018 while (n >= powers2Length) {
\r
33019 if (result.isZero() || (result.isNegative() && result.isUnit())) return result;
\r
33020 remQuo = divModAny(result, highestPower2);
\r
33021 result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
\r
33022 n -= powers2Length - 1;
\r
33024 remQuo = divModAny(result, powersOfTwo[n]);
\r
33025 return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
\r
33027 NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;
\r
33029 function bitwise(x, y, fn) {
\r
33030 y = parseValue(y);
\r
33031 var xSign = x.isNegative(), ySign = y.isNegative();
\r
33032 var xRem = xSign ? x.not() : x,
\r
33033 yRem = ySign ? y.not() : y;
\r
33034 var xDigit = 0, yDigit = 0;
\r
33035 var xDivMod = null, yDivMod = null;
\r
33037 while (!xRem.isZero() || !yRem.isZero()) {
\r
33038 xDivMod = divModAny(xRem, highestPower2);
\r
33039 xDigit = xDivMod[1].toJSNumber();
\r
33041 xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers
\r
33044 yDivMod = divModAny(yRem, highestPower2);
\r
33045 yDigit = yDivMod[1].toJSNumber();
\r
33047 yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers
\r
33050 xRem = xDivMod[0];
\r
33051 yRem = yDivMod[0];
\r
33052 result.push(fn(xDigit, yDigit));
\r
33054 var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);
\r
33055 for (var i = result.length - 1; i >= 0; i -= 1) {
\r
33056 sum = sum.multiply(highestPower2).add(bigInt(result[i]));
\r
33061 BigInteger.prototype.not = function () {
\r
33062 return this.negate().prev();
\r
33064 NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;
\r
33066 BigInteger.prototype.and = function (n) {
\r
33067 return bitwise(this, n, function (a, b) { return a & b; });
\r
33069 NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;
\r
33071 BigInteger.prototype.or = function (n) {
\r
33072 return bitwise(this, n, function (a, b) { return a | b; });
\r
33074 NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;
\r
33076 BigInteger.prototype.xor = function (n) {
\r
33077 return bitwise(this, n, function (a, b) { return a ^ b; });
\r
33079 NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;
\r
33081 var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;
\r
33082 function roughLOB(n) { // get lowestOneBit (rough)
\r
33083 // SmallInteger: return Min(lowestOneBit(n), 1 << 30)
\r
33084 // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7]
\r
33086 x = typeof v === "number" ? v | LOBMASK_I :
\r
33087 typeof v === "bigint" ? v | BigInt(LOBMASK_I) :
\r
33088 v[0] + v[1] * BASE | LOBMASK_BI;
\r
33092 function integerLogarithm(value, base) {
\r
33093 if (base.compareTo(value) <= 0) {
\r
33094 var tmp = integerLogarithm(value, base.square(base));
\r
33097 var t = p.multiply(base);
\r
33098 return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 };
\r
33100 return { p: bigInt(1), e: 0 };
\r
33103 BigInteger.prototype.bitLength = function () {
\r
33105 if (n.compareTo(bigInt(0)) < 0) {
\r
33106 n = n.negate().subtract(bigInt(1));
\r
33108 if (n.compareTo(bigInt(0)) === 0) {
\r
33109 return bigInt(0);
\r
33111 return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));
\r
33113 NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
\r
33115 function max(a, b) {
\r
33116 a = parseValue(a);
\r
33117 b = parseValue(b);
\r
33118 return a.greater(b) ? a : b;
\r
33120 function min(a, b) {
\r
33121 a = parseValue(a);
\r
33122 b = parseValue(b);
\r
33123 return a.lesser(b) ? a : b;
\r
33125 function gcd(a, b) {
\r
33126 a = parseValue(a).abs();
\r
33127 b = parseValue(b).abs();
\r
33128 if (a.equals(b)) return a;
\r
33129 if (a.isZero()) return b;
\r
33130 if (b.isZero()) return a;
\r
33131 var c = Integer[1], d, t;
\r
33132 while (a.isEven() && b.isEven()) {
\r
33133 d = min(roughLOB(a), roughLOB(b));
\r
33136 c = c.multiply(d);
\r
33138 while (a.isEven()) {
\r
33139 a = a.divide(roughLOB(a));
\r
33142 while (b.isEven()) {
\r
33143 b = b.divide(roughLOB(b));
\r
33145 if (a.greater(b)) {
\r
33146 t = b; b = a; a = t;
\r
33148 b = b.subtract(a);
\r
33149 } while (!b.isZero());
\r
33150 return c.isUnit() ? a : a.multiply(c);
\r
33152 function lcm(a, b) {
\r
33153 a = parseValue(a).abs();
\r
33154 b = parseValue(b).abs();
\r
33155 return a.divide(gcd(a, b)).multiply(b);
\r
33157 function randBetween(a, b, rng) {
\r
33158 a = parseValue(a);
\r
33159 b = parseValue(b);
\r
33160 var usedRNG = rng || Math.random;
\r
33161 var low = min(a, b), high = max(a, b);
\r
33162 var range = high.subtract(low).add(1);
\r
33163 if (range.isSmall) return low.add(Math.floor(usedRNG() * range));
\r
33164 var digits = toBase(range, BASE).value;
\r
33165 var result = [], restricted = true;
\r
33166 for (var i = 0; i < digits.length; i++) {
\r
33167 var top = restricted ? digits[i] : BASE;
\r
33168 var digit = truncate(usedRNG() * top);
\r
33169 result.push(digit);
\r
33170 if (digit < top) restricted = false;
\r
33172 return low.add(Integer.fromArray(result, BASE, false));
\r
33175 var parseBase = function (text, base, alphabet, caseSensitive) {
\r
33176 alphabet = alphabet || DEFAULT_ALPHABET;
\r
33177 text = String(text);
\r
33178 if (!caseSensitive) {
\r
33179 text = text.toLowerCase();
\r
33180 alphabet = alphabet.toLowerCase();
\r
33182 var length = text.length;
\r
33184 var absBase = Math.abs(base);
\r
33185 var alphabetValues = {};
\r
33186 for (i = 0; i < alphabet.length; i++) {
\r
33187 alphabetValues[alphabet[i]] = i;
\r
33189 for (i = 0; i < length; i++) {
\r
33191 if (c === "-") continue;
\r
33192 if (c in alphabetValues) {
\r
33193 if (alphabetValues[c] >= absBase) {
\r
33194 if (c === "1" && absBase === 1) continue;
\r
33195 throw new Error(c + " is not a valid digit in base " + base + ".");
\r
33199 base = parseValue(base);
\r
33201 var isNegative = text[0] === "-";
\r
33202 for (i = isNegative ? 1 : 0; i < text.length; i++) {
\r
33204 if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));
\r
33205 else if (c === "<") {
\r
33207 do { i++; } while (text[i] !== ">" && i < text.length);
\r
33208 digits.push(parseValue(text.slice(start + 1, i)));
\r
33210 else throw new Error(c + " is not a valid character");
\r
33212 return parseBaseFromArray(digits, base, isNegative);
\r
33215 function parseBaseFromArray(digits, base, isNegative) {
\r
33216 var val = Integer[0], pow = Integer[1], i;
\r
33217 for (i = digits.length - 1; i >= 0; i--) {
\r
33218 val = val.add(digits[i].times(pow));
\r
33219 pow = pow.times(base);
\r
33221 return isNegative ? val.negate() : val;
\r
33224 function stringify(digit, alphabet) {
\r
33225 alphabet = alphabet || DEFAULT_ALPHABET;
\r
33226 if (digit < alphabet.length) {
\r
33227 return alphabet[digit];
\r
33229 return "<" + digit + ">";
\r
33232 function toBase(n, base) {
\r
33233 base = bigInt(base);
\r
33234 if (base.isZero()) {
\r
33235 if (n.isZero()) return { value: [0], isNegative: false };
\r
33236 throw new Error("Cannot convert nonzero numbers to base 0.");
\r
33238 if (base.equals(-1)) {
\r
33239 if (n.isZero()) return { value: [0], isNegative: false };
\r
33240 if (n.isNegative())
\r
33242 value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber()))
\r
33243 .map(Array.prototype.valueOf, [1, 0])
\r
33245 isNegative: false
\r
33248 var arr = Array.apply(null, Array(n.toJSNumber() - 1))
\r
33249 .map(Array.prototype.valueOf, [0, 1]);
\r
33250 arr.unshift([1]);
\r
33252 value: [].concat.apply([], arr),
\r
33253 isNegative: false
\r
33258 if (n.isNegative() && base.isPositive()) {
\r
33262 if (base.isUnit()) {
\r
33263 if (n.isZero()) return { value: [0], isNegative: false };
\r
33266 value: Array.apply(null, Array(n.toJSNumber()))
\r
33267 .map(Number.prototype.valueOf, 1),
\r
33272 var left = n, divmod;
\r
33273 while (left.isNegative() || left.compareAbs(base) >= 0) {
\r
33274 divmod = left.divmod(base);
\r
33275 left = divmod.quotient;
\r
33276 var digit = divmod.remainder;
\r
33277 if (digit.isNegative()) {
\r
33278 digit = base.minus(digit).abs();
\r
33279 left = left.next();
\r
33281 out.push(digit.toJSNumber());
\r
33283 out.push(left.toJSNumber());
\r
33284 return { value: out.reverse(), isNegative: neg };
\r
33287 function toBaseString(n, base, alphabet) {
\r
33288 var arr = toBase(n, base);
\r
33289 return (arr.isNegative ? "-" : "") + arr.value.map(function (x) {
\r
33290 return stringify(x, alphabet);
\r
33294 BigInteger.prototype.toArray = function (radix) {
\r
33295 return toBase(this, radix);
\r
33298 SmallInteger.prototype.toArray = function (radix) {
\r
33299 return toBase(this, radix);
\r
33302 NativeBigInt.prototype.toArray = function (radix) {
\r
33303 return toBase(this, radix);
\r
33306 BigInteger.prototype.toString = function (radix, alphabet) {
\r
33307 if (radix === undefined) radix = 10;
\r
33308 if (radix !== 10) return toBaseString(this, radix, alphabet);
\r
33309 var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;
\r
33310 while (--l >= 0) {
\r
33311 digit = String(v[l]);
\r
33312 str += zeros.slice(digit.length) + digit;
\r
33314 var sign = this.sign ? "-" : "";
\r
33315 return sign + str;
\r
33318 SmallInteger.prototype.toString = function (radix, alphabet) {
\r
33319 if (radix === undefined) radix = 10;
\r
33320 if (radix != 10) return toBaseString(this, radix, alphabet);
\r
33321 return String(this.value);
\r
33324 NativeBigInt.prototype.toString = SmallInteger.prototype.toString;
\r
33326 NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); }
\r
33328 BigInteger.prototype.valueOf = function () {
\r
33329 return parseInt(this.toString(), 10);
\r
33331 BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;
\r
33333 SmallInteger.prototype.valueOf = function () {
\r
33334 return this.value;
\r
33336 SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
\r
33337 NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () {
\r
33338 return parseInt(this.toString(), 10);
\r
33341 function parseStringValue(v) {
\r
33342 if (isPrecise(+v)) {
\r
33344 if (x === truncate(x))
\r
33345 return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);
\r
33346 throw new Error("Invalid integer: " + v);
\r
33348 var sign = v[0] === "-";
\r
33349 if (sign) v = v.slice(1);
\r
33350 var split = v.split(/e/i);
\r
33351 if (split.length > 2) throw new Error("Invalid integer: " + split.join("e"));
\r
33352 if (split.length === 2) {
\r
33353 var exp = split[1];
\r
33354 if (exp[0] === "+") exp = exp.slice(1);
\r
33356 if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
\r
33357 var text = split[0];
\r
33358 var decimalPlace = text.indexOf(".");
\r
33359 if (decimalPlace >= 0) {
\r
33360 exp -= text.length - decimalPlace - 1;
\r
33361 text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);
\r
33363 if (exp < 0) throw new Error("Cannot include negative exponent part for integers");
\r
33364 text += (new Array(exp + 1)).join("0");
\r
33367 var isValid = /^([0-9][0-9]*)$/.test(v);
\r
33368 if (!isValid) throw new Error("Invalid integer: " + v);
\r
33369 if (supportsNativeBigInt) {
\r
33370 return new NativeBigInt(BigInt(sign ? "-" + v : v));
\r
33372 var r = [], max = v.length, l = LOG_BASE, min = max - l;
\r
33373 while (max > 0) {
\r
33374 r.push(+v.slice(min, max));
\r
33376 if (min < 0) min = 0;
\r
33380 return new BigInteger(r, sign);
\r
33383 function parseNumberValue(v) {
\r
33384 if (supportsNativeBigInt) {
\r
33385 return new NativeBigInt(BigInt(v));
\r
33387 if (isPrecise(v)) {
\r
33388 if (v !== truncate(v)) throw new Error(v + " is not an integer.");
\r
33389 return new SmallInteger(v);
\r
33391 return parseStringValue(v.toString());
\r
33394 function parseValue(v) {
\r
33395 if (typeof v === "number") {
\r
33396 return parseNumberValue(v);
\r
33398 if (typeof v === "string") {
\r
33399 return parseStringValue(v);
\r
33401 if (typeof v === "bigint") {
\r
33402 return new NativeBigInt(v);
\r
33406 // Pre-define numbers in range [-999,999]
\r
33407 for (var i = 0; i < 1000; i++) {
\r
33408 Integer[i] = parseValue(i);
\r
33409 if (i > 0) Integer[-i] = parseValue(-i);
\r
33411 // Backwards compatibility
\r
33412 Integer.one = Integer[1];
\r
33413 Integer.zero = Integer[0];
\r
33414 Integer.minusOne = Integer[-1];
\r
33415 Integer.max = max;
\r
33416 Integer.min = min;
\r
33417 Integer.gcd = gcd;
\r
33418 Integer.lcm = lcm;
\r
33419 Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; };
\r
33420 Integer.randBetween = randBetween;
\r
33422 Integer.fromArray = function (digits, base, isNegative) {
\r
33423 return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
\r
33430 if ( true && module.hasOwnProperty("exports")) {
\r
33431 module.exports = bigInt;
\r
33436 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
\r
33438 }).call(exports, __webpack_require__, exports, module),
33439 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
\r
33445 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
33447 const isWindows = process.platform === 'win32' ||
33448 process.env.OSTYPE === 'cygwin' ||
33449 process.env.OSTYPE === 'msys'
33451 const path = __webpack_require__(2)
33452 const COLON = isWindows ? ';' : ':'
33453 const isexe = __webpack_require__(217)
33455 const getNotFoundError = (cmd) =>
33456 Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
33458 const getPathInfo = (cmd, opt) => {
33459 const colon = opt.colon || COLON
33461 // If it has a slash, then we don't bother searching the pathenv.
33462 // just check the file itself, and that's it.
33463 const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? ['']
33466 // windows always checks the cwd first
33467 ...(isWindows ? [process.cwd()] : []),
33468 ...(opt.path || process.env.PATH ||
33469 /* istanbul ignore next: very unusual */ '').split(colon),
33472 const pathExtExe = isWindows
33473 ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'
33475 const pathExt = isWindows ? pathExtExe.split(colon) : ['']
33478 if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
33479 pathExt.unshift('')
33489 const which = (cmd, opt, cb) => {
33490 if (typeof opt === 'function') {
33497 const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
33500 const step = i => new Promise((resolve, reject) => {
33501 if (i === pathEnv.length)
33502 return opt.all && found.length ? resolve(found)
33503 : reject(getNotFoundError(cmd))
33505 const ppRaw = pathEnv[i]
33506 const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
33508 const pCmd = path.join(pathPart, cmd)
33509 const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
33512 resolve(subStep(p, i, 0))
33515 const subStep = (p, i, ii) => new Promise((resolve, reject) => {
33516 if (ii === pathExt.length)
33517 return resolve(step(i + 1))
33518 const ext = pathExt[ii]
33519 isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
33522 found.push(p + ext)
33524 return resolve(p + ext)
33526 return resolve(subStep(p, i, ii + 1))
33530 return cb ? step(0).then(res => cb(null, res), cb) : step(0)
33533 const whichSync = (cmd, opt) => {
33536 const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
33539 for (let i = 0; i < pathEnv.length; i ++) {
33540 const ppRaw = pathEnv[i]
33541 const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
33543 const pCmd = path.join(pathPart, cmd)
33544 const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
33547 for (let j = 0; j < pathExt.length; j ++) {
33548 const cur = p + pathExt[j]
33550 const is = isexe.sync(cur, { pathExt: pathExtExe })
33561 if (opt.all && found.length)
33567 throw getNotFoundError(cmd)
33570 module.exports = which
33571 which.sync = whichSync
33576 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
33578 var fs = __webpack_require__(42)
33580 if (process.platform === 'win32' || global.TESTING_WINDOWS) {
33581 core = __webpack_require__(218)
33583 core = __webpack_require__(219)
33586 module.exports = isexe
33589 function isexe (path, options, cb) {
33590 if (typeof options === 'function') {
33596 if (typeof Promise !== 'function') {
33597 throw new TypeError('callback not provided')
33600 return new Promise(function (resolve, reject) {
33601 isexe(path, options || {}, function (er, is) {
33611 core(path, options || {}, function (er, is) {
33612 // ignore EACCES because that just means we aren't allowed to run it
33614 if (er.code === 'EACCES' || options && options.ignoreErrors) {
33623 function sync (path, options) {
33624 // my kingdom for a filtered catch
33626 return core.sync(path, options || {})
33628 if (options && options.ignoreErrors || er.code === 'EACCES') {
33639 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
33641 module.exports = isexe
33644 var fs = __webpack_require__(42)
33646 function checkPathExt (path, options) {
33647 var pathext = options.pathExt !== undefined ?
33648 options.pathExt : process.env.PATHEXT
33654 pathext = pathext.split(';')
33655 if (pathext.indexOf('') !== -1) {
33658 for (var i = 0; i < pathext.length; i++) {
33659 var p = pathext[i].toLowerCase()
33660 if (p && path.substr(-p.length).toLowerCase() === p) {
33667 function checkStat (stat, path, options) {
33668 if (!stat.isSymbolicLink() && !stat.isFile()) {
33671 return checkPathExt(path, options)
33674 function isexe (path, options, cb) {
33675 fs.stat(path, function (er, stat) {
33676 cb(er, er ? false : checkStat(stat, path, options))
33680 function sync (path, options) {
33681 return checkStat(fs.statSync(path), path, options)
33687 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
33689 module.exports = isexe
33692 var fs = __webpack_require__(42)
33694 function isexe (path, options, cb) {
33695 fs.stat(path, function (er, stat) {
33696 cb(er, er ? false : checkStat(stat, options))
33700 function sync (path, options) {
33701 return checkStat(fs.statSync(path), options)
33704 function checkStat (stat, options) {
33705 return stat.isFile() && checkMode(stat, options)
33708 function checkMode (stat, options) {
33709 var mod = stat.mode
33713 var myUid = options.uid !== undefined ?
33714 options.uid : process.getuid && process.getuid()
33715 var myGid = options.gid !== undefined ?
33716 options.gid : process.getgid && process.getgid()
33718 var u = parseInt('100', 8)
33719 var g = parseInt('010', 8)
33720 var o = parseInt('001', 8)
33723 var ret = (mod & o) ||
33724 (mod & g) && gid === myGid ||
33725 (mod & u) && uid === myUid ||
33726 (mod & ug) && myUid === 0
33734 /************************************************************************/
33735 /******/ // The module cache
33736 /******/ var __webpack_module_cache__ = {};
33738 /******/ // The require function
33739 /******/ function __webpack_require__(moduleId) {
33740 /******/ // Check if module is in cache
33741 /******/ if(__webpack_module_cache__[moduleId]) {
33742 /******/ return __webpack_module_cache__[moduleId].exports;
33744 /******/ // Create a new module (and put it into the cache)
33745 /******/ var module = __webpack_module_cache__[moduleId] = {
33746 /******/ id: moduleId,
33747 /******/ loaded: false,
33748 /******/ exports: {}
33751 /******/ // Execute the module function
33752 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
33754 /******/ // Flag the module as loaded
33755 /******/ module.loaded = true;
33757 /******/ // Return the exports of the module
33758 /******/ return module.exports;
33761 /************************************************************************/
33762 /******/ /* webpack/runtime/define property getters */
33764 /******/ // define getter functions for harmony exports
33765 /******/ __webpack_require__.d = (exports, definition) => {
33766 /******/ for(var key in definition) {
33767 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
33768 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
33774 /******/ /* webpack/runtime/hasOwnProperty shorthand */
33776 /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
33779 /******/ /* webpack/runtime/make namespace object */
33781 /******/ // define __esModule on exports
33782 /******/ __webpack_require__.r = (exports) => {
33783 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
33784 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
33786 /******/ Object.defineProperty(exports, '__esModule', { value: true });
33790 /******/ /* webpack/runtime/node module decorator */
33792 /******/ __webpack_require__.nmd = (module) => {
33793 /******/ module.paths = [];
33794 /******/ if (!module.children) module.children = [];
33795 /******/ return module;
33799 /************************************************************************/
33800 /******/ // module exports must be returned from runtime so entry inlining is disabled
33801 /******/ // startup
33802 /******/ // Load entry module and return exports
33803 /******/ return __webpack_require__(0);