patchright-core 1.50.1 → 1.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ThirdPartyNotices.txt +1 -43
- package/browsers.json +22 -10
- package/index.js +0 -1
- package/lib/androidServerImpl.js +4 -4
- package/lib/browserServerImpl.js +18 -9
- package/lib/cli/driver.js +6 -6
- package/lib/cli/program.js +9 -9
- package/lib/cli/programWithTestStub.js +2 -1
- package/lib/client/android.js +37 -58
- package/lib/client/artifact.js +4 -7
- package/lib/client/browser.js +10 -15
- package/lib/client/browserContext.js +77 -73
- package/lib/client/browserType.js +30 -64
- package/lib/client/channelOwner.js +23 -20
- package/lib/client/clientHelper.js +5 -7
- package/lib/client/clientStackTrace.js +65 -0
- package/lib/client/connection.js +46 -39
- package/lib/client/consoleMessage.js +4 -7
- package/lib/client/electron.js +10 -10
- package/lib/client/elementHandle.js +32 -33
- package/lib/client/errors.js +2 -2
- package/lib/client/eventEmitter.js +5 -8
- package/lib/client/fetch.js +60 -61
- package/lib/client/fileUtils.js +31 -0
- package/lib/client/frame.js +30 -29
- package/lib/client/harRouter.js +7 -9
- package/lib/client/jsHandle.js +3 -4
- package/lib/client/localUtils.js +24 -0
- package/lib/client/locator.js +37 -18
- package/lib/client/network.js +40 -40
- package/lib/client/page.js +59 -55
- package/lib/client/platform.js +71 -0
- package/lib/client/playwright.js +21 -1
- package/lib/client/selectors.js +8 -2
- package/lib/client/stream.js +2 -21
- package/lib/client/timeoutSettings.js +65 -0
- package/lib/client/tracing.js +10 -7
- package/lib/client/video.js +2 -2
- package/lib/client/waiter.js +5 -6
- package/lib/client/webSocket.js +106 -0
- package/lib/client/worker.js +12 -10
- package/lib/client/writableStream.js +2 -21
- package/lib/generated/consoleApiSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/inProcessFactory.js +6 -3
- package/lib/outofprocess.js +12 -8
- package/lib/protocol/validator.js +64 -13
- package/lib/protocol/validatorPrimitives.js +1 -2
- package/lib/remote/playwrightConnection.js +18 -10
- package/lib/remote/playwrightServer.js +20 -7
- package/lib/server/android/android.js +17 -14
- package/lib/server/android/backendAdb.js +14 -14
- package/lib/server/artifact.js +3 -3
- package/lib/server/bidi/bidiBrowser.js +2 -2
- package/lib/server/bidi/bidiChromium.js +4 -3
- package/lib/server/bidi/bidiConnection.js +1 -1
- package/lib/server/bidi/bidiExecutionContext.js +70 -40
- package/lib/server/bidi/bidiFirefox.js +4 -3
- package/lib/server/bidi/bidiInput.js +5 -8
- package/lib/server/bidi/bidiNetworkManager.js +3 -3
- package/lib/server/bidi/bidiOverCdp.js +2 -2
- package/lib/server/bidi/bidiPage.js +30 -46
- package/lib/server/bidi/third_party/firefoxPrefs.js +19 -3
- package/lib/server/browser.js +2 -2
- package/lib/server/browserContext.js +37 -40
- package/lib/server/browserType.js +18 -17
- package/lib/{utils/sequence.js → server/callLog.js} +18 -3
- package/lib/server/chromium/chromium.js +14 -14
- package/lib/server/chromium/chromiumSwitches.js +32 -1
- package/lib/server/chromium/crBrowser.js +15 -14
- package/lib/server/chromium/crConnection.js +2 -2
- package/lib/server/chromium/crCoverage.js +1 -1
- package/lib/server/chromium/crDevTools.js +1 -1
- package/lib/server/chromium/crDragDrop.js +1 -1
- package/lib/server/chromium/crExecutionContext.js +25 -17
- package/lib/server/chromium/crInput.js +2 -2
- package/lib/server/chromium/crNetworkManager.js +73 -26
- package/lib/server/chromium/crPage.js +22 -23
- package/lib/server/chromium/crPdf.js +1 -1
- package/lib/server/chromium/crProtocolHelper.js +3 -3
- package/lib/server/chromium/crServiceWorker.js +2 -2
- package/lib/server/chromium/videoRecorder.js +2 -2
- package/lib/server/clock.js +1 -1
- package/lib/server/codegen/javascript.js +1 -1
- package/lib/server/codegen/languages.js +2 -2
- package/lib/server/debugController.js +3 -3
- package/lib/server/deviceDescriptors.js +1 -1
- package/lib/server/deviceDescriptorsSource.json +131 -131
- package/lib/server/dispatchers/androidDispatcher.js +1 -1
- package/lib/server/dispatchers/artifactDispatcher.js +3 -3
- package/lib/server/dispatchers/browserContextDispatcher.js +19 -19
- package/lib/server/dispatchers/browserTypeDispatcher.js +1 -1
- package/lib/server/dispatchers/cdpSessionDispatcher.js +1 -1
- package/lib/server/dispatchers/dispatcher.js +27 -25
- package/lib/server/dispatchers/electronDispatcher.js +3 -3
- package/lib/server/dispatchers/elementHandlerDispatcher.js +7 -2
- package/lib/server/dispatchers/frameDispatcher.js +4 -4
- package/lib/server/dispatchers/jsHandleDispatcher.js +2 -2
- package/lib/server/dispatchers/jsonPipeDispatcher.js +2 -2
- package/lib/server/dispatchers/localUtilsDispatcher.js +25 -298
- package/lib/server/dispatchers/networkDispatchers.js +3 -3
- package/lib/server/dispatchers/pageDispatcher.js +11 -9
- package/lib/server/dispatchers/playwrightDispatcher.js +5 -5
- package/lib/server/dispatchers/streamDispatcher.js +4 -3
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +8 -7
- package/lib/server/dispatchers/writableStreamDispatcher.js +5 -6
- package/lib/server/dom.js +18 -12
- package/lib/server/download.js +1 -1
- package/lib/server/electron/electron.js +17 -16
- package/lib/server/errors.js +1 -1
- package/lib/server/fetch.js +36 -25
- package/lib/server/fileUploadUtils.js +7 -4
- package/lib/server/firefox/ffBrowser.js +8 -2
- package/lib/server/firefox/ffConnection.js +1 -1
- package/lib/server/firefox/ffExecutionContext.js +25 -17
- package/lib/server/firefox/ffNetworkManager.js +2 -2
- package/lib/server/firefox/ffPage.js +15 -21
- package/lib/server/firefox/firefox.js +7 -9
- package/lib/server/frameSelectors.js +1 -1
- package/lib/server/frames.js +366 -209
- package/lib/server/har/harRecorder.js +4 -4
- package/lib/server/har/harTracer.js +7 -8
- package/lib/server/harBackend.js +157 -0
- package/lib/server/helper.js +2 -2
- package/lib/server/index.js +1 -8
- package/lib/server/input.js +1 -1
- package/lib/server/instrumentation.js +2 -2
- package/lib/server/isomorphic/utilityScriptSerializers.js +3 -0
- package/lib/server/javascript.js +46 -33
- package/lib/server/launchApp.js +2 -2
- package/lib/server/localUtils.js +203 -0
- package/lib/server/network.js +3 -3
- package/lib/server/page.js +41 -22
- package/lib/server/pipeTransport.js +1 -1
- package/lib/server/playwright.js +5 -5
- package/lib/server/progress.js +1 -1
- package/lib/server/protocolError.js +1 -1
- package/lib/server/recorder/contextRecorder.js +3 -3
- package/lib/server/recorder/recorderApp.js +18 -12
- package/lib/server/recorder/recorderCollection.js +3 -3
- package/lib/server/recorder/throttledFile.js +3 -4
- package/lib/server/recorder.js +7 -5
- package/lib/server/registry/browserFetcher.js +9 -7
- package/lib/server/registry/dependencies.js +15 -15
- package/lib/server/registry/index.js +38 -44
- package/lib/server/registry/oopDownloadBrowserMain.js +3 -3
- package/lib/server/screenshotter.js +1 -1
- package/lib/server/selectors.js +3 -3
- package/lib/server/socksClientCertificatesInterceptor.js +8 -8
- package/lib/server/socksInterceptor.js +8 -5
- package/lib/server/storageScript.js +160 -0
- package/lib/{common → server}/timeoutSettings.js +6 -5
- package/lib/server/trace/recorder/snapshotter.js +9 -8
- package/lib/server/trace/recorder/tracing.js +40 -31
- package/lib/server/trace/test/inMemorySnapshotter.js +4 -4
- package/lib/server/trace/viewer/traceViewer.js +13 -5
- package/lib/server/transport.js +2 -2
- package/lib/{utils → server/utils}/comparators.js +4 -4
- package/lib/{utils → server/utils}/crypto.js +4 -4
- package/lib/{utils → server/utils}/debug.js +4 -12
- package/lib/{utils → server/utils}/debugLogger.js +2 -2
- package/lib/{utils → server/utils}/env.js +4 -0
- package/lib/{utils → server/utils}/expectUtils.js +1 -1
- package/lib/{utils → server/utils}/fileUtils.js +4 -5
- package/lib/{utils/happy-eyeballs.js → server/utils/happyEyeballs.js} +22 -24
- package/lib/{utils → server/utils}/hostPlatform.js +1 -1
- package/lib/{utils → server/utils}/httpServer.js +8 -8
- package/lib/{utils → server/utils}/linuxUtils.js +3 -23
- package/lib/{utils → server/utils}/network.js +4 -4
- package/lib/server/utils/nodePlatform.js +140 -0
- package/lib/{protocol/transport.js → server/utils/pipeTransport.js} +2 -2
- package/lib/{utils → server/utils}/processLauncher.js +5 -5
- package/lib/{utils → server/utils}/profiler.js +5 -6
- package/lib/{common → server/utils}/socksProxy.js +10 -9
- package/lib/{utils → server/utils}/userAgent.js +2 -16
- package/lib/{utils → server/utils}/wsServer.js +3 -3
- package/lib/{utils → server/utils}/zipFile.js +1 -1
- package/lib/{utils → server/utils}/zones.js +9 -24
- package/lib/server/webkit/webkit.js +4 -4
- package/lib/server/webkit/wkBrowser.js +4 -4
- package/lib/server/webkit/wkConnection.js +1 -1
- package/lib/server/webkit/wkExecutionContext.js +25 -17
- package/lib/server/webkit/wkInput.js +2 -2
- package/lib/server/webkit/wkInterceptableRequest.js +2 -2
- package/lib/server/webkit/wkPage.js +41 -40
- package/lib/server/webkit/wkProvisionalPage.js +1 -1
- package/lib/server/webkit/wkWorkers.js +2 -2
- package/lib/utils/isomorphic/ariaSnapshot.js +2 -1
- package/lib/utils/isomorphic/assert.js +25 -0
- package/lib/utils/isomorphic/colors.js +65 -0
- package/lib/utils/isomorphic/cssParser.js +1 -1
- package/lib/utils/isomorphic/locatorGenerators.js +13 -1
- package/lib/utils/isomorphic/locatorParser.js +2 -2
- package/lib/utils/{manualPromise.js → isomorphic/manualPromise.js} +3 -5
- package/lib/utils/isomorphic/mimeType.js +11 -3
- package/lib/utils/{multimap.js → isomorphic/multimap.js} +1 -3
- package/lib/utils/{rtti.js → isomorphic/rtti.js} +2 -5
- package/lib/utils/isomorphic/stackTrace.js +169 -0
- package/lib/utils/isomorphic/stringUtils.js +1 -1
- package/lib/utils/{time.js → isomorphic/time.js} +1 -13
- package/lib/utils/{timeoutRunner.js → isomorphic/timeoutRunner.js} +4 -4
- package/lib/utils/isomorphic/traceUtils.js +23 -0
- package/lib/{utils/index.js → utils.js} +200 -121
- package/lib/utilsBundle.js +1 -25
- package/lib/utilsBundleImpl/index.js +114 -116
- package/lib/vite/htmlReport/index.html +20 -20
- package/lib/vite/recorder/assets/codeMirrorModule-B9YMkrwa.js +24 -0
- package/lib/vite/recorder/assets/index-ELPgmkwA.js +184 -0
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-DpJ-EmBQ.js +24 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-DTenqiGw.js +259 -0
- package/lib/vite/traceViewer/assets/{xtermModule-c-SNdYZy.js → xtermModule-BoAIEibi.js} +7 -7
- package/lib/vite/traceViewer/defaultSettingsView.5fN5lw10.css +1 -0
- package/lib/vite/traceViewer/index.CUq7VgrV.js +2 -0
- package/lib/vite/traceViewer/index.html +3 -3
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/uiMode.CHJSAD7F.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/lib/zipBundleImpl.js +4 -4
- package/package.json +7 -7
- package/types/protocol.d.ts +123 -99
- package/types/types.d.ts +91 -37
- package/lib/utils/stackTrace.js +0 -134
- package/lib/utils/traceUtils.js +0 -44
- package/lib/vite/recorder/assets/codeMirrorModule-CNAqJrkA.js +0 -24
- package/lib/vite/recorder/assets/index-DGS0JLxS.js +0 -184
- package/lib/vite/traceViewer/assets/codeMirrorModule-D55P_UuL.js +0 -24
- package/lib/vite/traceViewer/assets/defaultSettingsView-B-uNoFsX.js +0 -243
- package/lib/vite/traceViewer/defaultSettingsView.2xeEXCXv.css +0 -1
- package/lib/vite/traceViewer/index.BfvuujqP.js +0 -2
- package/lib/vite/traceViewer/uiMode.CStJu6jo.js +0 -5
- /package/lib/{utils → server/utils}/ascii.js +0 -0
- /package/lib/{utils → server/utils}/eventsHelper.js +0 -0
- /package/lib/{image_tools → server/utils/image_tools}/colorUtils.js +0 -0
- /package/lib/{image_tools → server/utils/image_tools}/compare.js +0 -0
- /package/lib/{image_tools → server/utils/image_tools}/imageChannel.js +0 -0
- /package/lib/{image_tools → server/utils/image_tools}/stats.js +0 -0
- /package/lib/{utils → server/utils}/spawnAsync.js +0 -0
- /package/lib/{utils → server/utils}/task.js +0 -0
- /package/lib/utils/{headers.js → isomorphic/headers.js} +0 -0
- /package/lib/utils/{semaphore.js → isomorphic/semaphore.js} +0 -0
- /package/lib/{common → utils/isomorphic}/types.js +0 -0
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getMimeTypeForPath = getMimeTypeForPath;
|
|
6
7
|
exports.isJsonMimeType = isJsonMimeType;
|
|
7
8
|
exports.isTextualMimeType = isTextualMimeType;
|
|
8
9
|
/**
|
|
9
10
|
* Copyright (c) Microsoft Corporation.
|
|
10
11
|
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
12
13
|
* you may not use this file except in compliance with the License.
|
|
13
14
|
* You may obtain a copy of the License at
|
|
14
15
|
*
|
|
15
16
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
17
|
*
|
|
17
18
|
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an
|
|
19
|
+
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
19
20
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
21
|
* See the License for the specific language governing permissions and
|
|
21
22
|
* limitations under the License.
|
|
@@ -26,4 +27,11 @@ function isJsonMimeType(mimeType) {
|
|
|
26
27
|
}
|
|
27
28
|
function isTextualMimeType(mimeType) {
|
|
28
29
|
return !!mimeType.match(/^(text\/.*?|application\/(json|(x-)?javascript|xml.*?|ecmascript|graphql|x-www-form-urlencoded)|image\/svg(\+xml)?|application\/.*?(\+json|\+xml))(;\s*charset=.*)?$/);
|
|
29
|
-
}
|
|
30
|
+
}
|
|
31
|
+
function getMimeTypeForPath(path) {
|
|
32
|
+
const dotIndex = path.lastIndexOf('.');
|
|
33
|
+
if (dotIndex === -1) return null;
|
|
34
|
+
const extension = path.substring(dotIndex + 1);
|
|
35
|
+
return types.get(extension) || null;
|
|
36
|
+
}
|
|
37
|
+
const types = new Map([['ez', 'application/andrew-inset'], ['aw', 'application/applixware'], ['atom', 'application/atom+xml'], ['atomcat', 'application/atomcat+xml'], ['atomdeleted', 'application/atomdeleted+xml'], ['atomsvc', 'application/atomsvc+xml'], ['dwd', 'application/atsc-dwd+xml'], ['held', 'application/atsc-held+xml'], ['rsat', 'application/atsc-rsat+xml'], ['bdoc', 'application/bdoc'], ['xcs', 'application/calendar+xml'], ['ccxml', 'application/ccxml+xml'], ['cdfx', 'application/cdfx+xml'], ['cdmia', 'application/cdmi-capability'], ['cdmic', 'application/cdmi-container'], ['cdmid', 'application/cdmi-domain'], ['cdmio', 'application/cdmi-object'], ['cdmiq', 'application/cdmi-queue'], ['cu', 'application/cu-seeme'], ['mpd', 'application/dash+xml'], ['davmount', 'application/davmount+xml'], ['dbk', 'application/docbook+xml'], ['dssc', 'application/dssc+der'], ['xdssc', 'application/dssc+xml'], ['ecma', 'application/ecmascript'], ['es', 'application/ecmascript'], ['emma', 'application/emma+xml'], ['emotionml', 'application/emotionml+xml'], ['epub', 'application/epub+zip'], ['exi', 'application/exi'], ['exp', 'application/express'], ['fdt', 'application/fdt+xml'], ['pfr', 'application/font-tdpfr'], ['geojson', 'application/geo+json'], ['gml', 'application/gml+xml'], ['gpx', 'application/gpx+xml'], ['gxf', 'application/gxf'], ['gz', 'application/gzip'], ['hjson', 'application/hjson'], ['stk', 'application/hyperstudio'], ['ink', 'application/inkml+xml'], ['inkml', 'application/inkml+xml'], ['ipfix', 'application/ipfix'], ['its', 'application/its+xml'], ['ear', 'application/java-archive'], ['jar', 'application/java-archive'], ['war', 'application/java-archive'], ['ser', 'application/java-serialized-object'], ['class', 'application/java-vm'], ['js', 'application/javascript'], ['mjs', 'application/javascript'], ['json', 'application/json'], ['map', 'application/json'], ['json5', 'application/json5'], ['jsonml', 'application/jsonml+json'], ['jsonld', 'application/ld+json'], ['lgr', 'application/lgr+xml'], ['lostxml', 'application/lost+xml'], ['hqx', 'application/mac-binhex40'], ['cpt', 'application/mac-compactpro'], ['mads', 'application/mads+xml'], ['webmanifest', 'application/manifest+json'], ['mrc', 'application/marc'], ['mrcx', 'application/marcxml+xml'], ['ma', 'application/mathematica'], ['mb', 'application/mathematica'], ['nb', 'application/mathematica'], ['mathml', 'application/mathml+xml'], ['mbox', 'application/mbox'], ['mscml', 'application/mediaservercontrol+xml'], ['metalink', 'application/metalink+xml'], ['meta4', 'application/metalink4+xml'], ['mets', 'application/mets+xml'], ['maei', 'application/mmt-aei+xml'], ['musd', 'application/mmt-usd+xml'], ['mods', 'application/mods+xml'], ['m21', 'application/mp21'], ['mp21', 'application/mp21'], ['m4p', 'application/mp4'], ['mp4s', 'application/mp4'], ['doc', 'application/msword'], ['dot', 'application/msword'], ['mxf', 'application/mxf'], ['nq', 'application/n-quads'], ['nt', 'application/n-triples'], ['cjs', 'application/node'], ['bin', 'application/octet-stream'], ['bpk', 'application/octet-stream'], ['buffer', 'application/octet-stream'], ['deb', 'application/octet-stream'], ['deploy', 'application/octet-stream'], ['dist', 'application/octet-stream'], ['distz', 'application/octet-stream'], ['dll', 'application/octet-stream'], ['dmg', 'application/octet-stream'], ['dms', 'application/octet-stream'], ['dump', 'application/octet-stream'], ['elc', 'application/octet-stream'], ['exe', 'application/octet-stream'], ['img', 'application/octet-stream'], ['iso', 'application/octet-stream'], ['lrf', 'application/octet-stream'], ['mar', 'application/octet-stream'], ['msi', 'application/octet-stream'], ['msm', 'application/octet-stream'], ['msp', 'application/octet-stream'], ['pkg', 'application/octet-stream'], ['so', 'application/octet-stream'], ['oda', 'application/oda'], ['opf', 'application/oebps-package+xml'], ['ogx', 'application/ogg'], ['omdoc', 'application/omdoc+xml'], ['onepkg', 'application/onenote'], ['onetmp', 'application/onenote'], ['onetoc', 'application/onenote'], ['onetoc2', 'application/onenote'], ['oxps', 'application/oxps'], ['relo', 'application/p2p-overlay+xml'], ['xer', 'application/patch-ops-error+xml'], ['pdf', 'application/pdf'], ['pgp', 'application/pgp-encrypted'], ['asc', 'application/pgp-signature'], ['sig', 'application/pgp-signature'], ['prf', 'application/pics-rules'], ['p10', 'application/pkcs10'], ['p7c', 'application/pkcs7-mime'], ['p7m', 'application/pkcs7-mime'], ['p7s', 'application/pkcs7-signature'], ['p8', 'application/pkcs8'], ['ac', 'application/pkix-attr-cert'], ['cer', 'application/pkix-cert'], ['crl', 'application/pkix-crl'], ['pkipath', 'application/pkix-pkipath'], ['pki', 'application/pkixcmp'], ['pls', 'application/pls+xml'], ['ai', 'application/postscript'], ['eps', 'application/postscript'], ['ps', 'application/postscript'], ['provx', 'application/provenance+xml'], ['pskcxml', 'application/pskc+xml'], ['raml', 'application/raml+yaml'], ['owl', 'application/rdf+xml'], ['rdf', 'application/rdf+xml'], ['rif', 'application/reginfo+xml'], ['rnc', 'application/relax-ng-compact-syntax'], ['rl', 'application/resource-lists+xml'], ['rld', 'application/resource-lists-diff+xml'], ['rs', 'application/rls-services+xml'], ['rapd', 'application/route-apd+xml'], ['sls', 'application/route-s-tsid+xml'], ['rusd', 'application/route-usd+xml'], ['gbr', 'application/rpki-ghostbusters'], ['mft', 'application/rpki-manifest'], ['roa', 'application/rpki-roa'], ['rsd', 'application/rsd+xml'], ['rss', 'application/rss+xml'], ['rtf', 'application/rtf'], ['sbml', 'application/sbml+xml'], ['scq', 'application/scvp-cv-request'], ['scs', 'application/scvp-cv-response'], ['spq', 'application/scvp-vp-request'], ['spp', 'application/scvp-vp-response'], ['sdp', 'application/sdp'], ['senmlx', 'application/senml+xml'], ['sensmlx', 'application/sensml+xml'], ['setpay', 'application/set-payment-initiation'], ['setreg', 'application/set-registration-initiation'], ['shf', 'application/shf+xml'], ['sieve', 'application/sieve'], ['siv', 'application/sieve'], ['smi', 'application/smil+xml'], ['smil', 'application/smil+xml'], ['rq', 'application/sparql-query'], ['srx', 'application/sparql-results+xml'], ['gram', 'application/srgs'], ['grxml', 'application/srgs+xml'], ['sru', 'application/sru+xml'], ['ssdl', 'application/ssdl+xml'], ['ssml', 'application/ssml+xml'], ['swidtag', 'application/swid+xml'], ['tei', 'application/tei+xml'], ['teicorpus', 'application/tei+xml'], ['tfi', 'application/thraud+xml'], ['tsd', 'application/timestamped-data'], ['toml', 'application/toml'], ['trig', 'application/trig'], ['ttml', 'application/ttml+xml'], ['ubj', 'application/ubjson'], ['rsheet', 'application/urc-ressheet+xml'], ['td', 'application/urc-targetdesc+xml'], ['vxml', 'application/voicexml+xml'], ['wasm', 'application/wasm'], ['wgt', 'application/widget'], ['hlp', 'application/winhlp'], ['wsdl', 'application/wsdl+xml'], ['wspolicy', 'application/wspolicy+xml'], ['xaml', 'application/xaml+xml'], ['xav', 'application/xcap-att+xml'], ['xca', 'application/xcap-caps+xml'], ['xdf', 'application/xcap-diff+xml'], ['xel', 'application/xcap-el+xml'], ['xns', 'application/xcap-ns+xml'], ['xenc', 'application/xenc+xml'], ['xht', 'application/xhtml+xml'], ['xhtml', 'application/xhtml+xml'], ['xlf', 'application/xliff+xml'], ['rng', 'application/xml'], ['xml', 'application/xml'], ['xsd', 'application/xml'], ['xsl', 'application/xml'], ['dtd', 'application/xml-dtd'], ['xop', 'application/xop+xml'], ['xpl', 'application/xproc+xml'], ['*xsl', 'application/xslt+xml'], ['xslt', 'application/xslt+xml'], ['xspf', 'application/xspf+xml'], ['mxml', 'application/xv+xml'], ['xhvml', 'application/xv+xml'], ['xvm', 'application/xv+xml'], ['xvml', 'application/xv+xml'], ['yang', 'application/yang'], ['yin', 'application/yin+xml'], ['zip', 'application/zip'], ['*3gpp', 'audio/3gpp'], ['adp', 'audio/adpcm'], ['amr', 'audio/amr'], ['au', 'audio/basic'], ['snd', 'audio/basic'], ['kar', 'audio/midi'], ['mid', 'audio/midi'], ['midi', 'audio/midi'], ['rmi', 'audio/midi'], ['mxmf', 'audio/mobile-xmf'], ['*mp3', 'audio/mp3'], ['m4a', 'audio/mp4'], ['mp4a', 'audio/mp4'], ['m2a', 'audio/mpeg'], ['m3a', 'audio/mpeg'], ['mp2', 'audio/mpeg'], ['mp2a', 'audio/mpeg'], ['mp3', 'audio/mpeg'], ['mpga', 'audio/mpeg'], ['oga', 'audio/ogg'], ['ogg', 'audio/ogg'], ['opus', 'audio/ogg'], ['spx', 'audio/ogg'], ['s3m', 'audio/s3m'], ['sil', 'audio/silk'], ['wav', 'audio/wav'], ['*wav', 'audio/wave'], ['weba', 'audio/webm'], ['xm', 'audio/xm'], ['ttc', 'font/collection'], ['otf', 'font/otf'], ['ttf', 'font/ttf'], ['woff', 'font/woff'], ['woff2', 'font/woff2'], ['exr', 'image/aces'], ['apng', 'image/apng'], ['avif', 'image/avif'], ['bmp', 'image/bmp'], ['cgm', 'image/cgm'], ['drle', 'image/dicom-rle'], ['emf', 'image/emf'], ['fits', 'image/fits'], ['g3', 'image/g3fax'], ['gif', 'image/gif'], ['heic', 'image/heic'], ['heics', 'image/heic-sequence'], ['heif', 'image/heif'], ['heifs', 'image/heif-sequence'], ['hej2', 'image/hej2k'], ['hsj2', 'image/hsj2'], ['ief', 'image/ief'], ['jls', 'image/jls'], ['jp2', 'image/jp2'], ['jpg2', 'image/jp2'], ['jpe', 'image/jpeg'], ['jpeg', 'image/jpeg'], ['jpg', 'image/jpeg'], ['jph', 'image/jph'], ['jhc', 'image/jphc'], ['jpm', 'image/jpm'], ['jpf', 'image/jpx'], ['jpx', 'image/jpx'], ['jxr', 'image/jxr'], ['jxra', 'image/jxra'], ['jxrs', 'image/jxrs'], ['jxs', 'image/jxs'], ['jxsc', 'image/jxsc'], ['jxsi', 'image/jxsi'], ['jxss', 'image/jxss'], ['ktx', 'image/ktx'], ['ktx2', 'image/ktx2'], ['png', 'image/png'], ['sgi', 'image/sgi'], ['svg', 'image/svg+xml'], ['svgz', 'image/svg+xml'], ['t38', 'image/t38'], ['tif', 'image/tiff'], ['tiff', 'image/tiff'], ['tfx', 'image/tiff-fx'], ['webp', 'image/webp'], ['wmf', 'image/wmf'], ['disposition-notification', 'message/disposition-notification'], ['u8msg', 'message/global'], ['u8dsn', 'message/global-delivery-status'], ['u8mdn', 'message/global-disposition-notification'], ['u8hdr', 'message/global-headers'], ['eml', 'message/rfc822'], ['mime', 'message/rfc822'], ['3mf', 'model/3mf'], ['gltf', 'model/gltf+json'], ['glb', 'model/gltf-binary'], ['iges', 'model/iges'], ['igs', 'model/iges'], ['mesh', 'model/mesh'], ['msh', 'model/mesh'], ['silo', 'model/mesh'], ['mtl', 'model/mtl'], ['obj', 'model/obj'], ['stpx', 'model/step+xml'], ['stpz', 'model/step+zip'], ['stpxz', 'model/step-xml+zip'], ['stl', 'model/stl'], ['vrml', 'model/vrml'], ['wrl', 'model/vrml'], ['*x3db', 'model/x3d+binary'], ['x3dbz', 'model/x3d+binary'], ['x3db', 'model/x3d+fastinfoset'], ['*x3dv', 'model/x3d+vrml'], ['x3dvz', 'model/x3d+vrml'], ['x3d', 'model/x3d+xml'], ['x3dz', 'model/x3d+xml'], ['x3dv', 'model/x3d-vrml'], ['appcache', 'text/cache-manifest'], ['manifest', 'text/cache-manifest'], ['ics', 'text/calendar'], ['ifb', 'text/calendar'], ['coffee', 'text/coffeescript'], ['litcoffee', 'text/coffeescript'], ['css', 'text/css'], ['csv', 'text/csv'], ['htm', 'text/html'], ['html', 'text/html'], ['shtml', 'text/html'], ['jade', 'text/jade'], ['jsx', 'text/jsx'], ['less', 'text/less'], ['markdown', 'text/markdown'], ['md', 'text/markdown'], ['mml', 'text/mathml'], ['mdx', 'text/mdx'], ['n3', 'text/n3'], ['conf', 'text/plain'], ['def', 'text/plain'], ['in', 'text/plain'], ['ini', 'text/plain'], ['list', 'text/plain'], ['log', 'text/plain'], ['text', 'text/plain'], ['txt', 'text/plain'], ['rtx', 'text/richtext'], ['*rtf', 'text/rtf'], ['sgm', 'text/sgml'], ['sgml', 'text/sgml'], ['shex', 'text/shex'], ['slim', 'text/slim'], ['slm', 'text/slim'], ['spdx', 'text/spdx'], ['styl', 'text/stylus'], ['stylus', 'text/stylus'], ['tsv', 'text/tab-separated-values'], ['man', 'text/troff'], ['me', 'text/troff'], ['ms', 'text/troff'], ['roff', 'text/troff'], ['t', 'text/troff'], ['tr', 'text/troff'], ['ttl', 'text/turtle'], ['uri', 'text/uri-list'], ['uris', 'text/uri-list'], ['urls', 'text/uri-list'], ['vcard', 'text/vcard'], ['vtt', 'text/vtt'], ['*xml', 'text/xml'], ['yaml', 'text/yaml'], ['yml', 'text/yaml'], ['3gp', 'video/3gpp'], ['3gpp', 'video/3gpp'], ['3g2', 'video/3gpp2'], ['h261', 'video/h261'], ['h263', 'video/h263'], ['h264', 'video/h264'], ['m4s', 'video/iso.segment'], ['jpgv', 'video/jpeg'], ['jpm', 'video/jpm'], ['jpgm', 'video/jpm'], ['mj2', 'video/mj2'], ['mjp2', 'video/mj2'], ['ts', 'video/mp2t'], ['mp4', 'video/mp4'], ['mp4v', 'video/mp4'], ['mpg4', 'video/mp4'], ['m1v', 'video/mpeg'], ['m2v', 'video/mpeg'], ['mpe', 'video/mpeg'], ['mpeg', 'video/mpeg'], ['mpg', 'video/mpeg'], ['ogv', 'video/ogg'], ['mov', 'video/quicktime'], ['qt', 'video/quicktime'], ['webm', 'video/webm']]);
|
|
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MultiMap = void 0;
|
|
7
|
-
let _Symbol$iterator;
|
|
8
|
-
_Symbol$iterator = Symbol.iterator;
|
|
9
7
|
/**
|
|
10
8
|
* Copyright (c) Microsoft Corporation.
|
|
11
9
|
*
|
|
@@ -57,7 +55,7 @@ class MultiMap {
|
|
|
57
55
|
get size() {
|
|
58
56
|
return this._map.size;
|
|
59
57
|
}
|
|
60
|
-
[
|
|
58
|
+
[Symbol.iterator]() {
|
|
61
59
|
return this._map[Symbol.iterator]();
|
|
62
60
|
}
|
|
63
61
|
keys() {
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isError = isError;
|
|
7
|
-
exports.isLikelyNpxGlobal = void 0;
|
|
8
7
|
exports.isObject = isObject;
|
|
9
8
|
exports.isRegExp = isRegExp;
|
|
10
9
|
Object.defineProperty(exports, "isString", {
|
|
@@ -13,7 +12,7 @@ Object.defineProperty(exports, "isString", {
|
|
|
13
12
|
return _stringUtils.isString;
|
|
14
13
|
}
|
|
15
14
|
});
|
|
16
|
-
var _stringUtils = require("./
|
|
15
|
+
var _stringUtils = require("./stringUtils");
|
|
17
16
|
/**
|
|
18
17
|
* Copyright (c) Microsoft Corporation.
|
|
19
18
|
*
|
|
@@ -39,6 +38,4 @@ function isObject(obj) {
|
|
|
39
38
|
function isError(obj) {
|
|
40
39
|
var _Object$getPrototypeO;
|
|
41
40
|
return obj instanceof Error || obj && ((_Object$getPrototypeO = Object.getPrototypeOf(obj)) === null || _Object$getPrototypeO === void 0 ? void 0 : _Object$getPrototypeO.name) === 'Error';
|
|
42
|
-
}
|
|
43
|
-
const isLikelyNpxGlobal = () => process.argv.length >= 2 && process.argv[1].includes('_npx');
|
|
44
|
-
exports.isLikelyNpxGlobal = isLikelyNpxGlobal;
|
|
41
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.captureRawStack = captureRawStack;
|
|
7
|
+
exports.parseErrorStack = parseErrorStack;
|
|
8
|
+
exports.parseStackFrame = parseStackFrame;
|
|
9
|
+
exports.rewriteErrorMessage = rewriteErrorMessage;
|
|
10
|
+
exports.splitErrorMessage = splitErrorMessage;
|
|
11
|
+
exports.stringifyStackFrames = stringifyStackFrames;
|
|
12
|
+
/**
|
|
13
|
+
* The MIT License (MIT)
|
|
14
|
+
* Modifications copyright (c) Microsoft Corporation.
|
|
15
|
+
*
|
|
16
|
+
* Copyright (c) 2016-2023 Isaac Z. Schlueter i@izs.me, James Talmage james@talmage.io (github.com/jamestalmage), and
|
|
17
|
+
* Contributors
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
20
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
21
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
22
|
+
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
23
|
+
*
|
|
24
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
25
|
+
* Software.
|
|
26
|
+
*
|
|
27
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
28
|
+
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
29
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
30
|
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
function captureRawStack() {
|
|
34
|
+
const stackTraceLimit = Error.stackTraceLimit;
|
|
35
|
+
Error.stackTraceLimit = 50;
|
|
36
|
+
const error = new Error();
|
|
37
|
+
const stack = error.stack || '';
|
|
38
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
39
|
+
return stack.split('\n');
|
|
40
|
+
}
|
|
41
|
+
function parseStackFrame(text, pathSeparator, showInternalStackFrames) {
|
|
42
|
+
const match = text && text.match(re);
|
|
43
|
+
if (!match) return null;
|
|
44
|
+
let fname = match[2];
|
|
45
|
+
let file = match[7];
|
|
46
|
+
if (!file) return null;
|
|
47
|
+
if (!showInternalStackFrames && (file.startsWith('internal') || file.startsWith('node:'))) return null;
|
|
48
|
+
const line = match[8];
|
|
49
|
+
const column = match[9];
|
|
50
|
+
const closeParen = match[11] === ')';
|
|
51
|
+
const frame = {
|
|
52
|
+
file: '',
|
|
53
|
+
line: 0,
|
|
54
|
+
column: 0
|
|
55
|
+
};
|
|
56
|
+
if (line) frame.line = Number(line);
|
|
57
|
+
if (column) frame.column = Number(column);
|
|
58
|
+
if (closeParen && file) {
|
|
59
|
+
// make sure parens are balanced
|
|
60
|
+
// if we have a file like "asdf) [as foo] (xyz.js", then odds are
|
|
61
|
+
// that the fname should be += " (asdf) [as foo]" and the file
|
|
62
|
+
// should be just "xyz.js"
|
|
63
|
+
// walk backwards from the end to find the last unbalanced (
|
|
64
|
+
let closes = 0;
|
|
65
|
+
for (let i = file.length - 1; i > 0; i--) {
|
|
66
|
+
if (file.charAt(i) === ')') {
|
|
67
|
+
closes++;
|
|
68
|
+
} else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') {
|
|
69
|
+
closes--;
|
|
70
|
+
if (closes === -1 && file.charAt(i - 1) === ' ') {
|
|
71
|
+
const before = file.slice(0, i - 1);
|
|
72
|
+
const after = file.slice(i + 1);
|
|
73
|
+
file = after;
|
|
74
|
+
fname += ` (${before}`;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (fname) {
|
|
81
|
+
const methodMatch = fname.match(methodRe);
|
|
82
|
+
if (methodMatch) fname = methodMatch[1];
|
|
83
|
+
}
|
|
84
|
+
if (file) {
|
|
85
|
+
if (file.startsWith('file://')) file = fileURLToPath(file, pathSeparator);
|
|
86
|
+
frame.file = file;
|
|
87
|
+
}
|
|
88
|
+
if (fname) frame.function = fname;
|
|
89
|
+
return frame;
|
|
90
|
+
}
|
|
91
|
+
function rewriteErrorMessage(e, newMessage) {
|
|
92
|
+
var _e$stack;
|
|
93
|
+
const lines = (((_e$stack = e.stack) === null || _e$stack === void 0 ? void 0 : _e$stack.split('\n')) || []).filter(l => l.startsWith(' at '));
|
|
94
|
+
e.message = newMessage;
|
|
95
|
+
const errorTitle = `${e.name}: ${e.message}`;
|
|
96
|
+
if (lines.length) e.stack = `${errorTitle}\n${lines.join('\n')}`;
|
|
97
|
+
return e;
|
|
98
|
+
}
|
|
99
|
+
function stringifyStackFrames(frames) {
|
|
100
|
+
const stackLines = [];
|
|
101
|
+
for (const frame of frames) {
|
|
102
|
+
if (frame.function) stackLines.push(` at ${frame.function} (${frame.file}:${frame.line}:${frame.column})`);else stackLines.push(` at ${frame.file}:${frame.line}:${frame.column}`);
|
|
103
|
+
}
|
|
104
|
+
return stackLines;
|
|
105
|
+
}
|
|
106
|
+
function splitErrorMessage(message) {
|
|
107
|
+
const separationIdx = message.indexOf(':');
|
|
108
|
+
return {
|
|
109
|
+
name: separationIdx !== -1 ? message.slice(0, separationIdx) : '',
|
|
110
|
+
message: separationIdx !== -1 && separationIdx + 2 <= message.length ? message.substring(separationIdx + 2) : message
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function parseErrorStack(stack, pathSeparator, showInternalStackFrames = false) {
|
|
114
|
+
const lines = stack.split('\n');
|
|
115
|
+
let firstStackLine = lines.findIndex(line => line.startsWith(' at '));
|
|
116
|
+
if (firstStackLine === -1) firstStackLine = lines.length;
|
|
117
|
+
const message = lines.slice(0, firstStackLine).join('\n');
|
|
118
|
+
const stackLines = lines.slice(firstStackLine);
|
|
119
|
+
let location;
|
|
120
|
+
for (const line of stackLines) {
|
|
121
|
+
const frame = parseStackFrame(line, pathSeparator, showInternalStackFrames);
|
|
122
|
+
if (!frame || !frame.file) continue;
|
|
123
|
+
if (belongsToNodeModules(frame.file, pathSeparator)) continue;
|
|
124
|
+
location = {
|
|
125
|
+
file: frame.file,
|
|
126
|
+
column: frame.column || 0,
|
|
127
|
+
line: frame.line || 0
|
|
128
|
+
};
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
message,
|
|
133
|
+
stackLines,
|
|
134
|
+
location
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function belongsToNodeModules(file, pathSeparator) {
|
|
138
|
+
return file.includes(`${pathSeparator}node_modules${pathSeparator}`);
|
|
139
|
+
}
|
|
140
|
+
const re = new RegExp('^' +
|
|
141
|
+
// Sometimes we strip out the ' at' because it's noisy
|
|
142
|
+
'(?:\\s*at )?' +
|
|
143
|
+
// $1 = ctor if 'new'
|
|
144
|
+
'(?:(new) )?' +
|
|
145
|
+
// $2 = function name (can be literally anything)
|
|
146
|
+
// May contain method at the end as [as xyz]
|
|
147
|
+
'(?:(.*?) \\()?' +
|
|
148
|
+
// (eval at <anonymous> (file.js:1:1),
|
|
149
|
+
// $3 = eval origin
|
|
150
|
+
// $4:$5:$6 are eval file/line/col, but not normally reported
|
|
151
|
+
'(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?' +
|
|
152
|
+
// file:line:col
|
|
153
|
+
// $7:$8:$9
|
|
154
|
+
// $10 = 'native' if native
|
|
155
|
+
'(?:(.+?):(\\d+):(\\d+)|(native))' +
|
|
156
|
+
// maybe close the paren, then end
|
|
157
|
+
// if $11 is ), then we only allow balanced parens in the filename
|
|
158
|
+
// any imbalance is placed on the fname. This is a heuristic, and
|
|
159
|
+
// bound to be incorrect in some edge cases. The bet is that
|
|
160
|
+
// having weird characters in method names is more common than
|
|
161
|
+
// having weird characters in filenames, which seems reasonable.
|
|
162
|
+
'(\\)?)$');
|
|
163
|
+
const methodRe = /^(.*?) \[as (.*?)\]$/;
|
|
164
|
+
function fileURLToPath(fileUrl, pathSeparator) {
|
|
165
|
+
if (!fileUrl.startsWith('file://')) return fileUrl;
|
|
166
|
+
let path = decodeURIComponent(fileUrl.slice(7));
|
|
167
|
+
if (path.startsWith('/') && /^[a-zA-Z]:/.test(path.slice(1))) path = path.slice(1);
|
|
168
|
+
return path.replace(/\//g, pathSeparator);
|
|
169
|
+
}
|
|
@@ -85,7 +85,7 @@ function normalizeWhiteSpace(text) {
|
|
|
85
85
|
let result = (_normalizedWhitespace = normalizedWhitespaceCache) === null || _normalizedWhitespace === void 0 ? void 0 : _normalizedWhitespace.get(text);
|
|
86
86
|
if (result === undefined) {
|
|
87
87
|
var _normalizedWhitespace2;
|
|
88
|
-
result = text.replace(
|
|
88
|
+
result = text.replace(/[\u200b\u00ad]/g, '').trim().replace(/\s+/g, ' ');
|
|
89
89
|
(_normalizedWhitespace2 = normalizedWhitespaceCache) === null || _normalizedWhitespace2 === void 0 || _normalizedWhitespace2.set(text, result);
|
|
90
90
|
}
|
|
91
91
|
return result;
|
|
@@ -20,18 +20,6 @@ exports.monotonicTime = monotonicTime;
|
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
// The `process.hrtime()` returns a time from some arbitrary
|
|
24
|
-
// date in the past; on certain systems, this is the time from the system boot.
|
|
25
|
-
// The `monotonicTime()` converts this to milliseconds.
|
|
26
|
-
//
|
|
27
|
-
// For a Linux server with uptime of 36 days, the `monotonicTime()` value
|
|
28
|
-
// will be 36 * 86400 * 1000 = 3_110_400_000, which is larger than
|
|
29
|
-
// the maximum value that `setTimeout` accepts as an argument: 2_147_483_647.
|
|
30
|
-
//
|
|
31
|
-
// To make the `monotonicTime()` a reasonable value, we anchor
|
|
32
|
-
// it to the time of the first import of this utility.
|
|
33
|
-
const initialTime = process.hrtime();
|
|
34
23
|
function monotonicTime() {
|
|
35
|
-
|
|
36
|
-
return seconds * 1000 + (nanoseconds / 1000 | 0) / 1000;
|
|
24
|
+
return (performance.now() * 1000 | 0) / 1000;
|
|
37
25
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.pollAgainstDeadline = pollAgainstDeadline;
|
|
7
7
|
exports.raceAgainstDeadline = raceAgainstDeadline;
|
|
8
|
-
var
|
|
8
|
+
var _time = require("./time");
|
|
9
9
|
/**
|
|
10
10
|
* Copyright (c) Microsoft Corporation.
|
|
11
11
|
*
|
|
@@ -31,7 +31,7 @@ async function raceAgainstDeadline(cb, deadline) {
|
|
|
31
31
|
};
|
|
32
32
|
}), new Promise(resolve => {
|
|
33
33
|
const kMaxDeadline = 2147483647; // 2^31-1
|
|
34
|
-
const timeout = (deadline || kMaxDeadline) - (0,
|
|
34
|
+
const timeout = (deadline || kMaxDeadline) - (0, _time.monotonicTime)();
|
|
35
35
|
timer = setTimeout(() => resolve({
|
|
36
36
|
timedOut: true
|
|
37
37
|
}), timeout);
|
|
@@ -46,7 +46,7 @@ async function pollAgainstDeadline(callback, deadline, pollIntervals = [100, 250
|
|
|
46
46
|
const wrappedCallback = () => Promise.resolve().then(callback);
|
|
47
47
|
while (true) {
|
|
48
48
|
var _shift;
|
|
49
|
-
const time = (0,
|
|
49
|
+
const time = (0, _time.monotonicTime)();
|
|
50
50
|
if (deadline && time >= deadline) break;
|
|
51
51
|
const received = await raceAgainstDeadline(wrappedCallback, deadline);
|
|
52
52
|
if (received.timedOut) break;
|
|
@@ -56,7 +56,7 @@ async function pollAgainstDeadline(callback, deadline, pollIntervals = [100, 250
|
|
|
56
56
|
timedOut: false
|
|
57
57
|
};
|
|
58
58
|
const interval = (_shift = pollIntervals.shift()) !== null && _shift !== void 0 ? _shift : lastPollInterval;
|
|
59
|
-
if (deadline && deadline <= (0,
|
|
59
|
+
if (deadline && deadline <= (0, _time.monotonicTime)() + interval) break;
|
|
60
60
|
await new Promise(x => setTimeout(x, interval));
|
|
61
61
|
}
|
|
62
62
|
return {
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.parseClientSideCallMetadata = parseClientSideCallMetadata;
|
|
7
|
+
exports.serializeClientSideCallMetadata = serializeClientSideCallMetadata;
|
|
7
8
|
/**
|
|
8
9
|
* Copyright (c) Microsoft Corporation.
|
|
9
10
|
*
|
|
@@ -36,4 +37,26 @@ function parseClientSideCallMetadata(data) {
|
|
|
36
37
|
})));
|
|
37
38
|
}
|
|
38
39
|
return result;
|
|
40
|
+
}
|
|
41
|
+
function serializeClientSideCallMetadata(metadatas) {
|
|
42
|
+
const fileNames = new Map();
|
|
43
|
+
const stacks = [];
|
|
44
|
+
for (const m of metadatas) {
|
|
45
|
+
if (!m.stack || !m.stack.length) continue;
|
|
46
|
+
const stack = [];
|
|
47
|
+
for (const frame of m.stack) {
|
|
48
|
+
let ordinal = fileNames.get(frame.file);
|
|
49
|
+
if (typeof ordinal !== 'number') {
|
|
50
|
+
ordinal = fileNames.size;
|
|
51
|
+
fileNames.set(frame.file, ordinal);
|
|
52
|
+
}
|
|
53
|
+
const stackFrame = [ordinal, frame.line || 0, frame.column || 0, frame.function || ''];
|
|
54
|
+
stack.push(stackFrame);
|
|
55
|
+
}
|
|
56
|
+
stacks.push([m.id, stack]);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
files: [...fileNames.keys()],
|
|
60
|
+
stacks
|
|
61
|
+
};
|
|
39
62
|
}
|