@amazon/vinyl-util 1.1.1 → 2.0.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/dist/browserTestUtil/index.js +1853 -1853
- package/dist/browserTestUtil/index.js.map +4 -4
- package/dist/browserTestUtil/types/current/async/createCallbackTimingTest.d.ts +1 -1
- package/dist/browserTestUtil/types/current/async/createCallbackTimingTest.d.ts.map +1 -1
- package/dist/browserTestUtil/types/current/expect/typesafety.d.ts +5 -15
- package/dist/browserTestUtil/types/current/expect/typesafety.d.ts.map +1 -1
- package/dist/browserTestUtil/types/current/index.d.ts +17 -17
- package/dist/browserTestUtil/types/current/index.d.ts.map +1 -1
- package/dist/browserTestUtil/types/current/index.js +17 -17
- package/dist/browserTestUtil/types/current/mock/dom/globals.d.ts +4 -4
- package/dist/browserTestUtil/types/current/mock/dom/globals.d.ts.map +1 -1
- package/dist/browserTestUtil/types/current/mock/dom/globals.js +1 -1
- package/dist/browserTestUtil/types/current/mock/dom/lib.dom.d.ts +499 -499
- package/dist/browserTestUtil/types/current/mock/dom/lib.dom.d.ts.map +1 -1
- package/dist/browserTestUtil/types/current/mock/dom/lib.dom.js +1 -1
- package/dist/browserTestUtil/types/current/mock/implementEventFakes.js +1 -1
- package/dist/browserTestUtil/types/current/mock/polyfillCustomEvent.js +1 -1
- package/dist/browserTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/browserTestUtil/types/ts3.7/async/createCallbackTimingTest.d.ts +1 -1
- package/dist/browserTestUtil/types/ts3.7/expect/typesafety.d.ts +5 -15
- package/dist/browserTestUtil/types/ts3.7/index.d.ts +17 -17
- package/dist/browserTestUtil/types/ts3.7/mock/dom/globals.d.ts +4 -4
- package/dist/browserTestUtil/types/ts3.7/mock/dom/lib.dom.d.ts +499 -499
- package/dist/browserTestUtil/types/ts4.1/async/createCallbackTimingTest.d.ts +1 -1
- package/dist/browserTestUtil/types/ts4.1/expect/typesafety.d.ts +5 -15
- package/dist/browserTestUtil/types/ts4.1/index.d.ts +17 -17
- package/dist/browserTestUtil/types/ts4.1/mock/dom/globals.d.ts +4 -4
- package/dist/browserTestUtil/types/ts4.1/mock/dom/lib.dom.d.ts +499 -499
- package/dist/browserTestUtil/types/ts4.7/async/createCallbackTimingTest.d.ts +1 -1
- package/dist/browserTestUtil/types/ts4.7/expect/typesafety.d.ts +5 -15
- package/dist/browserTestUtil/types/ts4.7/index.d.ts +17 -17
- package/dist/browserTestUtil/types/ts4.7/mock/dom/globals.d.ts +4 -4
- package/dist/browserTestUtil/types/ts4.7/mock/dom/lib.dom.d.ts +499 -499
- package/dist/index.cjs +5054 -5024
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +5054 -5024
- package/dist/index.js.map +4 -4
- package/dist/polyfill/index.d.ts +1 -0
- package/dist/polyfill/index.d.ts.map +1 -1
- package/dist/polyfill/index.js +172 -105
- package/dist/polyfill/index.js.map +3 -3
- package/dist/polyfill/tsconfig.tsbuildinfo +1 -1
- package/dist/test/benchmark.es5.js +70 -70
- package/dist/test/benchmark.js +1396 -1395
- package/dist/test/benchmark.js.map +4 -4
- package/dist/testUtil/index.js +418 -418
- package/dist/testUtil/index.js.map +4 -4
- package/dist/testUtil/types/current/index.d.ts +16 -16
- package/dist/testUtil/types/current/index.d.ts.map +1 -1
- package/dist/testUtil/types/current/index.js +16 -16
- package/dist/testUtil/types/current/mock/logging/MockLogger.d.ts +1 -1
- package/dist/testUtil/types/current/mock/logging/MockLogger.d.ts.map +1 -1
- package/dist/testUtil/types/current/mock/logging/MockLogger.js +1 -1
- package/dist/testUtil/types/current/mock/navigator/setMockNavigator.js +1 -1
- package/dist/testUtil/types/current/mock/network/MockNetworkMetricsController.d.ts +1 -1
- package/dist/testUtil/types/current/mock/network/MockNetworkMetricsController.d.ts.map +1 -1
- package/dist/testUtil/types/current/mock/network/MockNetworkMetricsController.js +1 -1
- package/dist/testUtil/types/current/mock/network/MockNetworkState.d.ts +1 -1
- package/dist/testUtil/types/current/mock/network/MockNetworkState.d.ts.map +1 -1
- package/dist/testUtil/types/current/mock/network/MockNetworkState.js +1 -1
- package/dist/testUtil/types/current/mock/network/MockRequester.d.ts +1 -1
- package/dist/testUtil/types/current/mock/network/MockRequester.d.ts.map +1 -1
- package/dist/testUtil/types/current/mock/network/MockRequester.js +1 -1
- package/dist/testUtil/types/current/reporters/LogReporter.d.ts +1 -0
- package/dist/testUtil/types/current/reporters/LogReporter.d.ts.map +1 -1
- package/dist/testUtil/types/current/reporters/LogReporter.js +8 -0
- package/dist/testUtil/types/current/reporters/RestApiReporter.d.ts +1 -1
- package/dist/testUtil/types/current/reporters/RestApiReporter.d.ts.map +1 -1
- package/dist/testUtil/types/current/reporters/RestApiReporter.js +1 -1
- package/dist/testUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/testUtil/types/current/util/event/createEventSpy.d.ts.map +1 -1
- package/dist/testUtil/types/current/util/event/createEventSpy.js +6 -4
- package/dist/testUtil/types/ts3.7/index.d.ts +16 -16
- package/dist/testUtil/types/ts3.7/mock/logging/MockLogger.d.ts +1 -1
- package/dist/testUtil/types/ts3.7/mock/network/MockNetworkMetricsController.d.ts +1 -1
- package/dist/testUtil/types/ts3.7/mock/network/MockNetworkState.d.ts +1 -1
- package/dist/testUtil/types/ts3.7/mock/network/MockRequester.d.ts +1 -1
- package/dist/testUtil/types/ts3.7/reporters/LogReporter.d.ts +1 -0
- package/dist/testUtil/types/ts3.7/reporters/RestApiReporter.d.ts +1 -1
- package/dist/testUtil/types/ts4.1/index.d.ts +16 -16
- package/dist/testUtil/types/ts4.1/mock/logging/MockLogger.d.ts +1 -1
- package/dist/testUtil/types/ts4.1/mock/network/MockNetworkMetricsController.d.ts +1 -1
- package/dist/testUtil/types/ts4.1/mock/network/MockNetworkState.d.ts +1 -1
- package/dist/testUtil/types/ts4.1/mock/network/MockRequester.d.ts +1 -1
- package/dist/testUtil/types/ts4.1/reporters/LogReporter.d.ts +1 -0
- package/dist/testUtil/types/ts4.1/reporters/RestApiReporter.d.ts +2 -2
- package/dist/testUtil/types/ts4.7/index.d.ts +16 -16
- package/dist/testUtil/types/ts4.7/mock/logging/MockLogger.d.ts +1 -1
- package/dist/testUtil/types/ts4.7/mock/network/MockNetworkMetricsController.d.ts +1 -1
- package/dist/testUtil/types/ts4.7/mock/network/MockNetworkState.d.ts +1 -1
- package/dist/testUtil/types/ts4.7/mock/network/MockRequester.d.ts +1 -1
- package/dist/testUtil/types/ts4.7/reporters/LogReporter.d.ts +1 -0
- package/dist/testUtil/types/ts4.7/reporters/RestApiReporter.d.ts +1 -1
- package/dist/types/current/client/Version.d.ts.map +1 -1
- package/dist/types/current/client/userAgent/UserAgentInfo.d.ts +1 -1
- package/dist/types/current/client/userAgent/UserAgentInfo.d.ts.map +1 -1
- package/dist/types/current/client/userAgent/hasBrowser.d.ts.map +1 -1
- package/dist/types/current/client/userAgent/hasBrowser.js +1 -1
- package/dist/types/current/client/userAgent/parseUserAgent.d.ts +1 -1
- package/dist/types/current/client/userAgent/parseUserAgent.d.ts.map +1 -1
- package/dist/types/current/client/userAgent/tokenizeUserAgent.d.ts +1 -1
- package/dist/types/current/client/userAgent/tokenizeUserAgent.d.ts.map +1 -1
- package/dist/types/current/client/userAgent/tokenizeUserAgent.js +1 -1
- package/dist/types/current/client/userAgent/userAgentRuleHelpers.d.ts.map +1 -1
- package/dist/types/current/core/disposable.d.ts +1 -1
- package/dist/types/current/core/disposable.d.ts.map +1 -1
- package/dist/types/current/error/AbortError.js +1 -1
- package/dist/types/current/error/MediaUnsupportedError.d.ts +1 -1
- package/dist/types/current/error/MediaUnsupportedError.d.ts.map +1 -1
- package/dist/types/current/error/MediaUnsupportedError.js +2 -2
- package/dist/types/current/error/ReportableError.d.ts.map +1 -1
- package/dist/types/current/error/ServiceResponseError.d.ts.map +1 -1
- package/dist/types/current/error/TimeoutError.js +1 -1
- package/dist/types/current/error/ValidationError.d.ts +1 -1
- package/dist/types/current/error/ValidationError.d.ts.map +1 -1
- package/dist/types/current/error/ValidationError.js +2 -2
- package/dist/types/current/event/DomEventHost.d.ts +1 -1
- package/dist/types/current/event/DomEventHost.d.ts.map +1 -1
- package/dist/types/current/event/EventHost.d.ts.map +1 -1
- package/dist/types/current/event/Signal.d.ts.map +1 -1
- package/dist/types/current/event/nextEventAsPromise.d.ts +14 -4
- package/dist/types/current/event/nextEventAsPromise.d.ts.map +1 -1
- package/dist/types/current/event/nextEventAsPromise.js +8 -2
- package/dist/types/current/event/onAny.d.ts.map +1 -1
- package/dist/types/current/event/redispatchEvents.d.ts.map +1 -1
- package/dist/types/current/global/globalTarget.d.ts.map +1 -1
- package/dist/types/current/index.d.ts +114 -113
- package/dist/types/current/index.d.ts.map +1 -1
- package/dist/types/current/index.js +114 -113
- package/dist/types/current/logging/ConsoleLogHandler.d.ts.map +1 -1
- package/dist/types/current/logging/HistoryLogHandler.d.ts.map +1 -1
- package/dist/types/current/logging/Logger.d.ts +2 -2
- package/dist/types/current/logging/Logger.d.ts.map +1 -1
- package/dist/types/current/logging/Logger.js +1 -1
- package/dist/types/current/logging/VinylLogging.d.ts +2 -2
- package/dist/types/current/logging/VinylLogging.d.ts.map +1 -1
- package/dist/types/current/logging/getLogLevelFromSearch.d.ts +1 -1
- package/dist/types/current/logging/getLogLevelFromSearch.d.ts.map +1 -1
- package/dist/types/current/logging/getLogLevelFromSearch.js +2 -2
- package/dist/types/current/logging/logTimer.d.ts +1 -1
- package/dist/types/current/logging/logTimer.d.ts.map +1 -1
- package/dist/types/current/logging/logTimer.js +1 -1
- package/dist/types/current/network/RequestError.d.ts.map +1 -1
- package/dist/types/current/network/Requester.d.ts.map +1 -1
- package/dist/types/current/network/RequesterImpl.d.ts +1 -1
- package/dist/types/current/network/RequesterImpl.d.ts.map +1 -1
- package/dist/types/current/network/RequesterImplEventMap.d.ts +1 -1
- package/dist/types/current/network/RequesterImplEventMap.d.ts.map +1 -1
- package/dist/types/current/network/createRequester.d.ts.map +1 -1
- package/dist/types/current/network/logging/networkLoggingHandler.d.ts +1 -1
- package/dist/types/current/network/logging/networkLoggingHandler.d.ts.map +1 -1
- package/dist/types/current/network/metrics/NetworkMetricsController.d.ts.map +1 -1
- package/dist/types/current/network/metrics/NetworkMetricsControllerImpl.d.ts +1 -1
- package/dist/types/current/network/metrics/NetworkMetricsControllerImpl.d.ts.map +1 -1
- package/dist/types/current/network/metrics/networkMetricsGlobal.d.ts +1 -1
- package/dist/types/current/network/metrics/networkMetricsGlobal.d.ts.map +1 -1
- package/dist/types/current/network/metrics/networkMetricsGlobal.js +1 -1
- package/dist/types/current/network/metrics/networkMetricsModel.d.ts.map +1 -1
- package/dist/types/current/network/network.d.ts +1 -1
- package/dist/types/current/network/network.d.ts.map +1 -1
- package/dist/types/current/network/requesterGlobal.d.ts +1 -1
- package/dist/types/current/network/requesterGlobal.d.ts.map +1 -1
- package/dist/types/current/network/requesterUtil.d.ts.map +1 -1
- package/dist/types/current/patch/network/fetch.d.ts.map +1 -1
- package/dist/types/current/patch/patchTarget.d.ts.map +1 -1
- package/dist/types/current/persistence/PersistentItem.d.ts +1 -1
- package/dist/types/current/persistence/PersistentItem.d.ts.map +1 -1
- package/dist/types/current/persistence/PersistentItem.js +1 -1
- package/dist/types/current/persistence/StoragePersistence.d.ts +1 -1
- package/dist/types/current/persistence/StoragePersistence.d.ts.map +1 -1
- package/dist/types/current/persistence/persistenceRef.d.ts +2 -2
- package/dist/types/current/persistence/persistenceRef.d.ts.map +1 -1
- package/dist/types/current/persistence/persistenceRef.js +1 -1
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/current/util/async/Abort.d.ts.map +1 -1
- package/dist/types/current/util/async/Abort.js +1 -1
- package/dist/types/current/util/async/TaskQueue.d.ts +2 -2
- package/dist/types/current/util/async/TaskQueue.d.ts.map +1 -1
- package/dist/types/current/util/async/TaskQueue.js +1 -1
- package/dist/types/current/util/async/TimeoutController.d.ts +1 -1
- package/dist/types/current/util/async/TimeoutController.d.ts.map +1 -1
- package/dist/types/current/util/async/TimeoutController.js +1 -1
- package/dist/types/current/util/async/TimeoutSlot.d.ts.map +1 -1
- package/dist/types/current/util/async/abortUtils.d.ts +1 -1
- package/dist/types/current/util/async/abortUtils.d.ts.map +1 -1
- package/dist/types/current/util/async/poll.d.ts +34 -0
- package/dist/types/current/util/async/poll.d.ts.map +1 -0
- package/dist/types/current/util/async/poll.js +31 -0
- package/dist/types/current/util/async/promise.d.ts +1 -1
- package/dist/types/current/util/async/promise.d.ts.map +1 -1
- package/dist/types/current/util/async/promise.js +2 -2
- package/dist/types/current/util/async/sleep.d.ts +2 -1
- package/dist/types/current/util/async/sleep.d.ts.map +1 -1
- package/dist/types/current/util/async/timeout.d.ts +32 -10
- package/dist/types/current/util/async/timeout.d.ts.map +1 -1
- package/dist/types/current/util/async/timeout.js +8 -12
- package/dist/types/current/util/browser/searchParams.d.ts +1 -1
- package/dist/types/current/util/browser/searchParams.d.ts.map +1 -1
- package/dist/types/current/util/browser/searchParams.js +1 -1
- package/dist/types/current/util/buffer/BufferError.d.ts.map +1 -1
- package/dist/types/current/util/buffer/BufferReader.js +2 -2
- package/dist/types/current/util/buffer/buffer.d.ts +1 -1
- package/dist/types/current/util/buffer/buffer.d.ts.map +1 -1
- package/dist/types/current/util/collection/CacheMap.d.ts +12 -2
- package/dist/types/current/util/collection/CacheMap.d.ts.map +1 -1
- package/dist/types/current/util/collection/LinkedList.d.ts +1 -4
- package/dist/types/current/util/collection/LinkedList.d.ts.map +1 -1
- package/dist/types/current/util/collection/LruCache.js +1 -1
- package/dist/types/current/util/collection/array.d.ts +2 -2
- package/dist/types/current/util/collection/array.d.ts.map +1 -1
- package/dist/types/current/util/collection/array.js +2 -2
- package/dist/types/current/util/comparison/compare.d.ts +1 -1
- package/dist/types/current/util/comparison/compare.d.ts.map +1 -1
- package/dist/types/current/util/config/ValueProvider.d.ts +1 -1
- package/dist/types/current/util/config/ValueProvider.d.ts.map +1 -1
- package/dist/types/current/util/date/date.d.ts +1 -1
- package/dist/types/current/util/date/date.d.ts.map +1 -1
- package/dist/types/current/util/date/date.js +1 -1
- package/dist/types/current/util/error/stack.d.ts +3 -3
- package/dist/types/current/util/error/stack.d.ts.map +1 -1
- package/dist/types/current/util/error/stack.js +2 -2
- package/dist/types/current/util/fun/debounce.d.ts.map +1 -1
- package/dist/types/current/util/fun/debounce.js +1 -1
- package/dist/types/current/util/fun/memoize.d.ts +1 -1
- package/dist/types/current/util/fun/memoize.d.ts.map +1 -1
- package/dist/types/current/util/fun/memoize.js +2 -2
- package/dist/types/current/util/fun/throttle.d.ts.map +1 -1
- package/dist/types/current/util/fun/throttle.js +1 -1
- package/dist/types/current/util/map/map.d.ts +10 -2
- package/dist/types/current/util/map/map.d.ts.map +1 -1
- package/dist/types/current/util/mpeg/parseSidxBox.js +1 -1
- package/dist/types/current/util/network/request.d.ts +1 -1
- package/dist/types/current/util/network/request.d.ts.map +1 -1
- package/dist/types/current/util/object/equalDeep.d.ts +1 -1
- package/dist/types/current/util/object/equalDeep.d.ts.map +1 -1
- package/dist/types/current/util/object/equalDeep.js +1 -1
- package/dist/types/current/util/object/lazy.d.ts.map +1 -1
- package/dist/types/current/util/object/mergeDeep.d.ts +1 -1
- package/dist/types/current/util/object/mergeDeep.d.ts.map +1 -1
- package/dist/types/current/util/object/mergeDeep.js +3 -3
- package/dist/types/current/util/object/mutableType.d.ts +1 -1
- package/dist/types/current/util/object/mutableType.d.ts.map +1 -1
- package/dist/types/current/util/object/readonlyType.d.ts +1 -1
- package/dist/types/current/util/object/readonlyType.d.ts.map +1 -1
- package/dist/types/current/util/range/IntersectionRanges.d.ts +1 -1
- package/dist/types/current/util/range/IntersectionRanges.d.ts.map +1 -1
- package/dist/types/current/util/range/Ranges.js +1 -1
- package/dist/types/current/util/range/UnionRanges.d.ts +1 -1
- package/dist/types/current/util/range/UnionRanges.d.ts.map +1 -1
- package/dist/types/current/util/serialization/ParseError.js +1 -1
- package/dist/types/current/util/serialization/json.d.ts +1 -1
- package/dist/types/current/util/serialization/json.d.ts.map +1 -1
- package/dist/types/current/util/serialization/json.js +1 -1
- package/dist/types/current/util/serialization/primitives.d.ts +1 -1
- package/dist/types/current/util/serialization/primitives.d.ts.map +1 -1
- package/dist/types/current/util/serialization/stringifyForPrint.js +1 -1
- package/dist/types/current/util/string/StringReader.d.ts +2 -2
- package/dist/types/current/util/string/StringReader.d.ts.map +1 -1
- package/dist/types/current/util/string/StringReader.js +1 -1
- package/dist/types/current/util/string/string.d.ts +2 -2
- package/dist/types/current/util/string/string.d.ts.map +1 -1
- package/dist/types/current/util/string/string.js +1 -1
- package/dist/types/current/util/type.d.ts +13 -0
- package/dist/types/current/util/type.d.ts.map +1 -1
- package/dist/types/current/util/url/resolveUrl.d.ts +2 -1
- package/dist/types/current/util/url/resolveUrl.d.ts.map +1 -1
- package/dist/types/current/util/url/resolveUrl.js +9 -3
- package/dist/types/ts3.7/client/userAgent/UserAgentInfo.d.ts +1 -1
- package/dist/types/ts3.7/client/userAgent/parseUserAgent.d.ts +1 -1
- package/dist/types/ts3.7/client/userAgent/tokenizeUserAgent.d.ts +1 -1
- package/dist/types/ts3.7/core/disposable.d.ts +1 -1
- package/dist/types/ts3.7/error/MediaUnsupportedError.d.ts +1 -1
- package/dist/types/ts3.7/error/ValidationError.d.ts +1 -1
- package/dist/types/ts3.7/event/DomEventHost.d.ts +1 -1
- package/dist/types/ts3.7/event/nextEventAsPromise.d.ts +14 -4
- package/dist/types/ts3.7/index.d.ts +114 -113
- package/dist/types/ts3.7/logging/Logger.d.ts +2 -2
- package/dist/types/ts3.7/logging/VinylLogging.d.ts +2 -2
- package/dist/types/ts3.7/logging/getLogLevelFromSearch.d.ts +1 -1
- package/dist/types/ts3.7/logging/logTimer.d.ts +1 -1
- package/dist/types/ts3.7/network/RequesterImpl.d.ts +1 -1
- package/dist/types/ts3.7/network/RequesterImplEventMap.d.ts +1 -1
- package/dist/types/ts3.7/network/logging/networkLoggingHandler.d.ts +1 -1
- package/dist/types/ts3.7/network/metrics/NetworkMetricsControllerImpl.d.ts +1 -1
- package/dist/types/ts3.7/network/metrics/networkMetricsGlobal.d.ts +1 -1
- package/dist/types/ts3.7/network/network.d.ts +1 -1
- package/dist/types/ts3.7/network/requesterGlobal.d.ts +1 -1
- package/dist/types/ts3.7/persistence/PersistentItem.d.ts +1 -1
- package/dist/types/ts3.7/persistence/StoragePersistence.d.ts +1 -1
- package/dist/types/ts3.7/persistence/persistenceRef.d.ts +2 -2
- package/dist/types/ts3.7/util/async/TaskQueue.d.ts +2 -2
- package/dist/types/ts3.7/util/async/TimeoutController.d.ts +1 -1
- package/dist/types/ts3.7/util/async/abortUtils.d.ts +1 -1
- package/dist/types/ts3.7/util/async/poll.d.ts +34 -0
- package/dist/types/ts3.7/util/async/promise.d.ts +1 -1
- package/dist/types/ts3.7/util/async/sleep.d.ts +2 -1
- package/dist/types/ts3.7/util/async/timeout.d.ts +32 -10
- package/dist/types/ts3.7/util/browser/searchParams.d.ts +1 -1
- package/dist/types/ts3.7/util/buffer/buffer.d.ts +1 -1
- package/dist/types/ts3.7/util/collection/CacheMap.d.ts +12 -2
- package/dist/types/ts3.7/util/collection/LinkedList.d.ts +1 -4
- package/dist/types/ts3.7/util/collection/array.d.ts +2 -2
- package/dist/types/ts3.7/util/comparison/compare.d.ts +1 -1
- package/dist/types/ts3.7/util/config/ValueProvider.d.ts +1 -1
- package/dist/types/ts3.7/util/date/date.d.ts +1 -1
- package/dist/types/ts3.7/util/error/stack.d.ts +3 -3
- package/dist/types/ts3.7/util/fun/memoize.d.ts +1 -1
- package/dist/types/ts3.7/util/map/map.d.ts +13 -2
- package/dist/types/ts3.7/util/network/request.d.ts +1 -1
- package/dist/types/ts3.7/util/object/equalDeep.d.ts +1 -1
- package/dist/types/ts3.7/util/object/mergeDeep.d.ts +1 -1
- package/dist/types/ts3.7/util/object/mutableType.d.ts +1 -1
- package/dist/types/ts3.7/util/object/readonlyType.d.ts +1 -1
- package/dist/types/ts3.7/util/range/IntersectionRanges.d.ts +1 -1
- package/dist/types/ts3.7/util/range/UnionRanges.d.ts +1 -1
- package/dist/types/ts3.7/util/serialization/json.d.ts +1 -1
- package/dist/types/ts3.7/util/serialization/primitives.d.ts +1 -1
- package/dist/types/ts3.7/util/string/StringReader.d.ts +2 -2
- package/dist/types/ts3.7/util/string/string.d.ts +2 -2
- package/dist/types/ts3.7/util/type.d.ts +21 -0
- package/dist/types/ts3.7/util/url/resolveUrl.d.ts +2 -1
- package/dist/types/ts4.1/client/userAgent/UserAgentInfo.d.ts +1 -1
- package/dist/types/ts4.1/client/userAgent/parseUserAgent.d.ts +1 -1
- package/dist/types/ts4.1/client/userAgent/tokenizeUserAgent.d.ts +1 -1
- package/dist/types/ts4.1/core/disposable.d.ts +1 -1
- package/dist/types/ts4.1/error/MediaUnsupportedError.d.ts +1 -1
- package/dist/types/ts4.1/error/ValidationError.d.ts +1 -1
- package/dist/types/ts4.1/event/DomEventHost.d.ts +1 -1
- package/dist/types/ts4.1/event/nextEventAsPromise.d.ts +14 -4
- package/dist/types/ts4.1/index.d.ts +114 -113
- package/dist/types/ts4.1/logging/Logger.d.ts +2 -2
- package/dist/types/ts4.1/logging/VinylLogging.d.ts +2 -2
- package/dist/types/ts4.1/logging/getLogLevelFromSearch.d.ts +1 -1
- package/dist/types/ts4.1/logging/logTimer.d.ts +1 -1
- package/dist/types/ts4.1/network/RequesterImpl.d.ts +1 -1
- package/dist/types/ts4.1/network/RequesterImplEventMap.d.ts +1 -1
- package/dist/types/ts4.1/network/logging/networkLoggingHandler.d.ts +1 -1
- package/dist/types/ts4.1/network/metrics/NetworkMetricsControllerImpl.d.ts +1 -1
- package/dist/types/ts4.1/network/metrics/networkMetricsGlobal.d.ts +1 -1
- package/dist/types/ts4.1/network/network.d.ts +1 -1
- package/dist/types/ts4.1/network/requesterGlobal.d.ts +1 -1
- package/dist/types/ts4.1/persistence/PersistentItem.d.ts +1 -1
- package/dist/types/ts4.1/persistence/StoragePersistence.d.ts +1 -1
- package/dist/types/ts4.1/persistence/persistenceRef.d.ts +2 -2
- package/dist/types/ts4.1/util/async/TaskQueue.d.ts +2 -2
- package/dist/types/ts4.1/util/async/TimeoutController.d.ts +1 -1
- package/dist/types/ts4.1/util/async/abortUtils.d.ts +1 -1
- package/dist/types/ts4.1/util/async/poll.d.ts +34 -0
- package/dist/types/ts4.1/util/async/promise.d.ts +1 -1
- package/dist/types/ts4.1/util/async/sleep.d.ts +2 -1
- package/dist/types/ts4.1/util/async/timeout.d.ts +32 -10
- package/dist/types/ts4.1/util/browser/searchParams.d.ts +1 -1
- package/dist/types/ts4.1/util/buffer/buffer.d.ts +1 -1
- package/dist/types/ts4.1/util/collection/CacheMap.d.ts +12 -2
- package/dist/types/ts4.1/util/collection/LinkedList.d.ts +1 -4
- package/dist/types/ts4.1/util/collection/array.d.ts +2 -2
- package/dist/types/ts4.1/util/comparison/compare.d.ts +1 -1
- package/dist/types/ts4.1/util/config/ValueProvider.d.ts +1 -1
- package/dist/types/ts4.1/util/date/date.d.ts +1 -1
- package/dist/types/ts4.1/util/error/stack.d.ts +3 -3
- package/dist/types/ts4.1/util/fun/memoize.d.ts +1 -1
- package/dist/types/ts4.1/util/map/map.d.ts +13 -2
- package/dist/types/ts4.1/util/network/request.d.ts +1 -1
- package/dist/types/ts4.1/util/object/equalDeep.d.ts +1 -1
- package/dist/types/ts4.1/util/object/mergeDeep.d.ts +1 -1
- package/dist/types/ts4.1/util/object/mutableType.d.ts +1 -1
- package/dist/types/ts4.1/util/object/readonlyType.d.ts +1 -1
- package/dist/types/ts4.1/util/range/IntersectionRanges.d.ts +1 -1
- package/dist/types/ts4.1/util/range/UnionRanges.d.ts +1 -1
- package/dist/types/ts4.1/util/serialization/json.d.ts +1 -1
- package/dist/types/ts4.1/util/serialization/primitives.d.ts +1 -1
- package/dist/types/ts4.1/util/string/StringReader.d.ts +2 -2
- package/dist/types/ts4.1/util/string/string.d.ts +2 -2
- package/dist/types/ts4.1/util/type.d.ts +21 -0
- package/dist/types/ts4.1/util/url/resolveUrl.d.ts +2 -1
- package/dist/types/ts4.7/client/userAgent/UserAgentInfo.d.ts +1 -1
- package/dist/types/ts4.7/client/userAgent/parseUserAgent.d.ts +1 -1
- package/dist/types/ts4.7/client/userAgent/tokenizeUserAgent.d.ts +1 -1
- package/dist/types/ts4.7/core/disposable.d.ts +1 -1
- package/dist/types/ts4.7/error/MediaUnsupportedError.d.ts +1 -1
- package/dist/types/ts4.7/error/ValidationError.d.ts +1 -1
- package/dist/types/ts4.7/event/DomEventHost.d.ts +1 -1
- package/dist/types/ts4.7/event/nextEventAsPromise.d.ts +14 -4
- package/dist/types/ts4.7/index.d.ts +114 -113
- package/dist/types/ts4.7/logging/Logger.d.ts +2 -2
- package/dist/types/ts4.7/logging/VinylLogging.d.ts +2 -2
- package/dist/types/ts4.7/logging/getLogLevelFromSearch.d.ts +1 -1
- package/dist/types/ts4.7/logging/logTimer.d.ts +1 -1
- package/dist/types/ts4.7/network/RequesterImpl.d.ts +1 -1
- package/dist/types/ts4.7/network/RequesterImplEventMap.d.ts +1 -1
- package/dist/types/ts4.7/network/logging/networkLoggingHandler.d.ts +1 -1
- package/dist/types/ts4.7/network/metrics/NetworkMetricsControllerImpl.d.ts +1 -1
- package/dist/types/ts4.7/network/metrics/networkMetricsGlobal.d.ts +1 -1
- package/dist/types/ts4.7/network/network.d.ts +1 -1
- package/dist/types/ts4.7/network/requesterGlobal.d.ts +1 -1
- package/dist/types/ts4.7/persistence/PersistentItem.d.ts +1 -1
- package/dist/types/ts4.7/persistence/StoragePersistence.d.ts +1 -1
- package/dist/types/ts4.7/persistence/persistenceRef.d.ts +2 -2
- package/dist/types/ts4.7/util/async/TaskQueue.d.ts +2 -2
- package/dist/types/ts4.7/util/async/TimeoutController.d.ts +1 -1
- package/dist/types/ts4.7/util/async/abortUtils.d.ts +1 -1
- package/dist/types/ts4.7/util/async/poll.d.ts +34 -0
- package/dist/types/ts4.7/util/async/promise.d.ts +1 -1
- package/dist/types/ts4.7/util/async/sleep.d.ts +2 -1
- package/dist/types/ts4.7/util/async/timeout.d.ts +32 -10
- package/dist/types/ts4.7/util/browser/searchParams.d.ts +1 -1
- package/dist/types/ts4.7/util/buffer/buffer.d.ts +1 -1
- package/dist/types/ts4.7/util/collection/CacheMap.d.ts +12 -2
- package/dist/types/ts4.7/util/collection/LinkedList.d.ts +1 -4
- package/dist/types/ts4.7/util/collection/array.d.ts +2 -2
- package/dist/types/ts4.7/util/comparison/compare.d.ts +1 -1
- package/dist/types/ts4.7/util/config/ValueProvider.d.ts +1 -1
- package/dist/types/ts4.7/util/date/date.d.ts +1 -1
- package/dist/types/ts4.7/util/error/stack.d.ts +3 -3
- package/dist/types/ts4.7/util/fun/memoize.d.ts +1 -1
- package/dist/types/ts4.7/util/map/map.d.ts +13 -2
- package/dist/types/ts4.7/util/network/request.d.ts +1 -1
- package/dist/types/ts4.7/util/object/equalDeep.d.ts +1 -1
- package/dist/types/ts4.7/util/object/mergeDeep.d.ts +1 -1
- package/dist/types/ts4.7/util/object/mutableType.d.ts +1 -1
- package/dist/types/ts4.7/util/object/readonlyType.d.ts +1 -1
- package/dist/types/ts4.7/util/range/IntersectionRanges.d.ts +1 -1
- package/dist/types/ts4.7/util/range/UnionRanges.d.ts +1 -1
- package/dist/types/ts4.7/util/serialization/json.d.ts +1 -1
- package/dist/types/ts4.7/util/serialization/primitives.d.ts +1 -1
- package/dist/types/ts4.7/util/string/StringReader.d.ts +2 -2
- package/dist/types/ts4.7/util/string/string.d.ts +2 -2
- package/dist/types/ts4.7/util/type.d.ts +21 -0
- package/dist/types/ts4.7/util/url/resolveUrl.d.ts +2 -1
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -0
- package/package.json +17 -17
package/dist/test/benchmark.js
CHANGED
|
@@ -30,656 +30,158 @@
|
|
|
30
30
|
};
|
|
31
31
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
32
32
|
|
|
33
|
-
//
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
// src/error/ErrorOrigin.ts
|
|
34
|
+
var ErrorOrigin = {
|
|
35
|
+
/**
|
|
36
|
+
* The error originated from Vinyl and was reported from the uncaught exception or promise
|
|
37
|
+
* rejection handlers.
|
|
38
|
+
*/
|
|
39
|
+
UNCAUGHT: "uncaught",
|
|
40
|
+
/**
|
|
41
|
+
* The error originated from Vinyl and was caught.
|
|
42
|
+
*/
|
|
43
|
+
INTERNAL: "internal",
|
|
44
|
+
/**
|
|
45
|
+
* A Vinyl interface was used incorrectly by a consumer.
|
|
46
|
+
*/
|
|
47
|
+
API: "api",
|
|
48
|
+
/**
|
|
49
|
+
* The error originated from a failed service call (500 errors).
|
|
50
|
+
*/
|
|
51
|
+
SERVICE_EXTERNAL: "serviceExternal",
|
|
52
|
+
/**
|
|
53
|
+
* The error originated from a failed service call (400 errors).
|
|
54
|
+
*/
|
|
55
|
+
SERVICE_INTERNAL: "serviceInternal",
|
|
56
|
+
/**
|
|
57
|
+
* The error originated from a problem playing provided media.
|
|
58
|
+
* The reporter is from a component such as the element, source buffer, media source, etc.
|
|
59
|
+
*/
|
|
60
|
+
MEDIA: "media",
|
|
61
|
+
/**
|
|
62
|
+
* The error originated from a problem parsing input data.
|
|
63
|
+
* Such as a malformed Dash or HLS manifest.
|
|
64
|
+
*/
|
|
65
|
+
PARSING: "parsing",
|
|
66
|
+
/**
|
|
67
|
+
* The error originated from an incompatibility with browser APIs,
|
|
68
|
+
* such as EME.
|
|
69
|
+
*/
|
|
70
|
+
COMPATIBILITY: "compatibility",
|
|
71
|
+
/**
|
|
72
|
+
* The error originated from DRM.
|
|
73
|
+
* This does not include internal or service errors, only errors from the creation of media keys or media key
|
|
74
|
+
* sessions.
|
|
75
|
+
*/
|
|
76
|
+
DRM: "drm"
|
|
77
|
+
};
|
|
38
78
|
|
|
39
|
-
//
|
|
40
|
-
var
|
|
41
|
-
constructor() {
|
|
42
|
-
|
|
43
|
-
__publicField(this, "
|
|
44
|
-
__publicField(this, "
|
|
45
|
-
|
|
46
|
-
__publicField(this, "addEventListener", createSpy2("addEventListener"));
|
|
47
|
-
__publicField(this, "removeEventListener", createSpy2(
|
|
48
|
-
"removeEventListener"
|
|
49
|
-
));
|
|
50
|
-
__publicField(this, "dispatchEvent", createSpy2("dispatchEvent"));
|
|
79
|
+
// src/error/ReportableError.ts
|
|
80
|
+
var ReportableError = class _ReportableError extends Error {
|
|
81
|
+
constructor(message, origin = ErrorOrigin.INTERNAL, level = "fatal" /* FATAL */) {
|
|
82
|
+
super(message);
|
|
83
|
+
__publicField(this, "origin", origin);
|
|
84
|
+
__publicField(this, "level", level);
|
|
85
|
+
Object.setPrototypeOf(this, _ReportableError.prototype);
|
|
51
86
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"setLiveSeekableRange"
|
|
70
|
-
));
|
|
71
|
-
__publicField(this, "addEventListener", createSpy2("addEventListener"));
|
|
72
|
-
__publicField(this, "removeEventListener", createSpy2(
|
|
73
|
-
"removeEventListener"
|
|
74
|
-
));
|
|
75
|
-
__publicField(this, "dispatchEvent", createSpy2("dispatchEvent"));
|
|
87
|
+
get [Symbol.toStringTag]() {
|
|
88
|
+
return "ReportableError";
|
|
89
|
+
}
|
|
90
|
+
get name() {
|
|
91
|
+
return this[Symbol.toStringTag];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* All ReportableError instances must be serializable.
|
|
95
|
+
*/
|
|
96
|
+
toJSON() {
|
|
97
|
+
return {
|
|
98
|
+
level: this.level,
|
|
99
|
+
message: this.message,
|
|
100
|
+
name: this.name,
|
|
101
|
+
origin: this.origin,
|
|
102
|
+
stack: this.stack
|
|
103
|
+
};
|
|
76
104
|
}
|
|
77
105
|
};
|
|
78
106
|
|
|
79
|
-
//
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
));
|
|
86
|
-
var MockAbortSignalGlobal = class extends MockAbortSignal {
|
|
87
|
-
};
|
|
88
|
-
__publicField(MockAbortSignalGlobal, "abort", createSpy2("abort"));
|
|
89
|
-
__publicField(MockAbortSignalGlobal, "any", createSpy2("any"));
|
|
90
|
-
__publicField(MockAbortSignalGlobal, "timeout", createSpy2("timeout"));
|
|
91
|
-
|
|
92
|
-
// test/browserTestUtil/expect/expectNothing.ts
|
|
93
|
-
function expectNothing() {
|
|
94
|
-
expect(true).toBeTruthy();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// test/browserTestUtil/env/jasmineEnv.ts
|
|
98
|
-
var nextTestTimeoutOverridden = false;
|
|
99
|
-
function setTestTimeout(timeout) {
|
|
100
|
-
let originalTimeout = null;
|
|
101
|
-
beforeEach(() => {
|
|
102
|
-
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
103
|
-
if (!nextTestTimeoutOverridden)
|
|
104
|
-
jasmine.DEFAULT_TIMEOUT_INTERVAL = timeout * 1e3;
|
|
105
|
-
});
|
|
106
|
-
afterEach(() => {
|
|
107
|
-
if (originalTimeout) jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
|
108
|
-
if (nextTestTimeoutOverridden) nextTestTimeoutOverridden = false;
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// test/browserTestUtil/benchmark/Benchmark.ts
|
|
113
|
-
var now;
|
|
114
|
-
if (typeof window !== "undefined" && typeof window.performance !== "undefined" && typeof window.performance.now !== "undefined") {
|
|
115
|
-
now = () => window.performance.now();
|
|
116
|
-
} else if (typeof self !== "undefined" && typeof self.performance !== "undefined" && typeof self.performance.now !== "undefined") {
|
|
117
|
-
now = () => self.performance.now();
|
|
118
|
-
} else {
|
|
119
|
-
now = () => Date.now();
|
|
120
|
-
}
|
|
121
|
-
var BenchmarkRunResults = class {
|
|
122
|
-
constructor(name) {
|
|
123
|
-
this.name = name;
|
|
124
|
-
__publicField(this, "cycleResults", []);
|
|
125
|
-
__publicField(this, "_totalSamples", 0);
|
|
107
|
+
// src/error/IllegalArgumentError.ts
|
|
108
|
+
var IllegalArgumentError = class _IllegalArgumentError extends ReportableError {
|
|
109
|
+
constructor(message, isInternal = true) {
|
|
110
|
+
super(message, isInternal ? ErrorOrigin.INTERNAL : ErrorOrigin.API);
|
|
111
|
+
__publicField(this, "isInternal", isInternal);
|
|
112
|
+
Object.setPrototypeOf(this, _IllegalArgumentError.prototype);
|
|
126
113
|
}
|
|
127
|
-
get
|
|
128
|
-
return
|
|
114
|
+
get [Symbol.toStringTag]() {
|
|
115
|
+
return "IllegalArgumentError";
|
|
129
116
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// src/util/collection/LinkedList.ts
|
|
120
|
+
var LinkedList = class {
|
|
121
|
+
constructor() {
|
|
122
|
+
__publicField(this, "_head", null);
|
|
123
|
+
__publicField(this, "_tail", null);
|
|
137
124
|
}
|
|
138
125
|
/**
|
|
139
|
-
* Returns the
|
|
126
|
+
* Returns the current head.
|
|
140
127
|
*/
|
|
141
|
-
get
|
|
142
|
-
return
|
|
128
|
+
get head() {
|
|
129
|
+
return this._head;
|
|
143
130
|
}
|
|
144
|
-
|
|
145
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Returns the current tail.
|
|
133
|
+
*/
|
|
134
|
+
get tail() {
|
|
135
|
+
return this._tail;
|
|
146
136
|
}
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Returns true if the list is empty.
|
|
139
|
+
*/
|
|
140
|
+
get empty() {
|
|
141
|
+
return this._head === null;
|
|
149
142
|
}
|
|
150
143
|
/**
|
|
151
|
-
*
|
|
144
|
+
* Creates a new node for the given value, adding it to the end of the list.
|
|
145
|
+
*
|
|
146
|
+
* @param value
|
|
147
|
+
* @return Returns the newly created node.
|
|
152
148
|
*/
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
149
|
+
push(value) {
|
|
150
|
+
const node = {
|
|
151
|
+
previous: this._tail,
|
|
152
|
+
value,
|
|
153
|
+
removed: false,
|
|
154
|
+
next: null
|
|
155
|
+
};
|
|
156
|
+
this.pushNode(node);
|
|
157
|
+
return node;
|
|
161
158
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Appends all given values to the end of this list.
|
|
161
|
+
*
|
|
162
|
+
* @param values
|
|
163
|
+
*/
|
|
164
|
+
pushAll(...values) {
|
|
165
|
+
for (const value of values) {
|
|
166
|
+
this.push(value);
|
|
167
|
+
}
|
|
168
168
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
logToTable() {
|
|
186
|
-
const r = this.results.map((run) => {
|
|
187
|
-
const variance = run.variance.toLocaleString(void 0, {
|
|
188
|
-
style: "percent"
|
|
189
|
-
});
|
|
190
|
-
const mean = run.meanOpsPerSec.toLocaleString(void 0, {
|
|
191
|
-
maximumSignificantDigits: 4
|
|
192
|
-
});
|
|
193
|
-
return {
|
|
194
|
-
Name: run.name,
|
|
195
|
-
Mean: `${mean} \xB1${variance}`,
|
|
196
|
-
Samples: run.totalSamples,
|
|
197
|
-
Compare: this.runComparisonToString(run)
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
|
-
const table = r.reduce((acc, _a) => {
|
|
201
|
-
var _b = _a, { Name } = _b, x = __objRest(_b, ["Name"]);
|
|
202
|
-
acc[Name] = x;
|
|
203
|
-
return acc;
|
|
204
|
-
}, {});
|
|
205
|
-
console.log("\n" + this.name);
|
|
206
|
-
console.table(table);
|
|
207
|
-
}
|
|
208
|
-
runComparisonToString(run) {
|
|
209
|
-
var _a, _b;
|
|
210
|
-
const baseline = (_b = (_a = this.results[0]) == null ? void 0 : _a.meanOpsPerSec) != null ? _b : 0;
|
|
211
|
-
const fasterPercent = run.meanOpsPerSec / baseline - 1;
|
|
212
|
-
return fasterPercent < 0.01 ? "-" : fasterPercent.toLocaleString(void 0, {
|
|
213
|
-
style: "percent"
|
|
214
|
-
}) + " faster";
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
function compareResults(name, ...results) {
|
|
218
|
-
return new RunResultsComparison(name, results);
|
|
219
|
-
}
|
|
220
|
-
var defaultBenchmarkOptions = {
|
|
221
|
-
warmupTime: 0.5,
|
|
222
|
-
maxCycleDuration: 0.5,
|
|
223
|
-
cycles: 9
|
|
224
|
-
};
|
|
225
|
-
var _Benchmark = class _Benchmark {
|
|
226
|
-
/**
|
|
227
|
-
* Constructs a new Benchmark.
|
|
228
|
-
*
|
|
229
|
-
* @param name The name of the benchmark, to be used when logging.
|
|
230
|
-
* @param executor The method to execute and measure. If this method returns a promise, the
|
|
231
|
-
* promise will be awaited. The executor should either always return a promise, or never.
|
|
232
|
-
* @param options Optional configuration for the benchmark.
|
|
233
|
-
*/
|
|
234
|
-
constructor(name, executor, options) {
|
|
235
|
-
this.name = name;
|
|
236
|
-
this.executor = executor;
|
|
237
|
-
__publicField(this, "options");
|
|
238
|
-
this.options = __spreadValues(__spreadValues({}, defaultBenchmarkOptions), options);
|
|
239
|
-
}
|
|
240
|
-
async run() {
|
|
241
|
-
const opts = this.options;
|
|
242
|
-
await _Benchmark.semaphore;
|
|
243
|
-
const warmupTimeMs = opts.warmupTime * 1e3;
|
|
244
|
-
const cycleStart = now();
|
|
245
|
-
let isAsync = false;
|
|
246
|
-
do {
|
|
247
|
-
const result = this.executor();
|
|
248
|
-
isAsync = isAsync || result && typeof result.then === "function";
|
|
249
|
-
if (isAsync) await result;
|
|
250
|
-
} while (now() - cycleStart < warmupTimeMs);
|
|
251
|
-
const resultsPromise = (async () => {
|
|
252
|
-
const results = new BenchmarkRunResults(this.name);
|
|
253
|
-
for (let i = 0; i < opts.cycles; i++) {
|
|
254
|
-
const cycleResults = await this.runCycle(isAsync);
|
|
255
|
-
results.add(cycleResults);
|
|
256
|
-
await nextFrame();
|
|
257
|
-
}
|
|
258
|
-
return results;
|
|
259
|
-
})();
|
|
260
|
-
_Benchmark.semaphore = resultsPromise;
|
|
261
|
-
return await resultsPromise;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Runs one cycle. A cycle will repeat the executor approximately `options.maxCycleDuration`
|
|
265
|
-
* seconds.
|
|
266
|
-
*
|
|
267
|
-
* @param isAsync
|
|
268
|
-
* @return Returns the duration (in seconds) and number of operations the cycle repeated.
|
|
269
|
-
*/
|
|
270
|
-
async runCycle(isAsync) {
|
|
271
|
-
const cycleMs = this.options.maxCycleDuration * 1e3;
|
|
272
|
-
let ops = 0;
|
|
273
|
-
const cycleStart = now();
|
|
274
|
-
do {
|
|
275
|
-
const result = this.executor();
|
|
276
|
-
if (isAsync) await result;
|
|
277
|
-
ops++;
|
|
278
|
-
} while (now() - cycleStart < cycleMs);
|
|
279
|
-
const duration = (now() - cycleStart) / 1e3;
|
|
280
|
-
return {
|
|
281
|
-
duration,
|
|
282
|
-
ops
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
__publicField(_Benchmark, "semaphore", nextFrame());
|
|
287
|
-
var Benchmark = _Benchmark;
|
|
288
|
-
function benchmark(name, executor, options) {
|
|
289
|
-
const benchmark2 = new Benchmark(name, executor, options);
|
|
290
|
-
return benchmark2.run().then((results) => {
|
|
291
|
-
console.log(results.toString());
|
|
292
|
-
return results;
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
function nextFrame() {
|
|
296
|
-
return new Promise((resolve) => {
|
|
297
|
-
setTimeout(resolve);
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
function standardDeviation(values) {
|
|
301
|
-
const avg = average(values);
|
|
302
|
-
const squareDiffs = values.map((value) => {
|
|
303
|
-
const diff = value - avg;
|
|
304
|
-
return diff * diff;
|
|
305
|
-
});
|
|
306
|
-
const avgSquareDiff = average(squareDiffs);
|
|
307
|
-
return Math.sqrt(avgSquareDiff);
|
|
308
|
-
}
|
|
309
|
-
function average(values) {
|
|
310
|
-
const sum = values.reduce((acc, value) => acc + value, 0);
|
|
311
|
-
return sum / values.length;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// test/benchmark/setup.ts
|
|
315
|
-
function setupBenchmark() {
|
|
316
|
-
setTestTimeout(180);
|
|
317
|
-
afterEach(expectNothing);
|
|
318
|
-
}
|
|
319
|
-
var comparisons = [];
|
|
320
|
-
function addComparison(comparison) {
|
|
321
|
-
comparisons.push(comparison);
|
|
322
|
-
}
|
|
323
|
-
function addBenchmarks(name, ...results) {
|
|
324
|
-
const comparison = compareResults(name, ...results);
|
|
325
|
-
comparison.logToTable();
|
|
326
|
-
comparisons.push(comparison);
|
|
327
|
-
}
|
|
328
|
-
if (typeof document !== "undefined") {
|
|
329
|
-
jasmine.getEnv().addReporter({
|
|
330
|
-
jasmineDone: () => {
|
|
331
|
-
var _a;
|
|
332
|
-
console.log("Tests complete");
|
|
333
|
-
const jasmineContainer = document.getElementsByClassName(
|
|
334
|
-
"jasmine_html-reporter"
|
|
335
|
-
)[0];
|
|
336
|
-
(_a = jasmineContainer.parentElement) == null ? void 0 : _a.removeChild(jasmineContainer);
|
|
337
|
-
const container = createEl("div", document.body);
|
|
338
|
-
container.id = "benchmarkResults";
|
|
339
|
-
const sortedComparisons = [...comparisons].sort(
|
|
340
|
-
(a, b) => a.name > b.name ? 1 : -1
|
|
341
|
-
);
|
|
342
|
-
for (const comparison of sortedComparisons) {
|
|
343
|
-
toTableHtml(comparison, container);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
function toTableHtml(comparison, parent) {
|
|
349
|
-
const container = createEl("div", parent);
|
|
350
|
-
container.className = "benchmarkComparison";
|
|
351
|
-
const title = createEl("h2", container);
|
|
352
|
-
title.innerText = comparison.name;
|
|
353
|
-
const table = createEl("table", container);
|
|
354
|
-
const head = createEl("thead", table);
|
|
355
|
-
const headRow = createEl("tr", head);
|
|
356
|
-
const name = createEl("th", headRow);
|
|
357
|
-
name.innerText = "Name";
|
|
358
|
-
const median = createEl("th", headRow);
|
|
359
|
-
median.innerText = "Mean ops/s";
|
|
360
|
-
const samples = createEl("th", headRow);
|
|
361
|
-
samples.innerText = "Samples";
|
|
362
|
-
const compare = createEl("th", headRow);
|
|
363
|
-
compare.innerText = "% Comparison";
|
|
364
|
-
const body = createEl("tbody", table);
|
|
365
|
-
comparison.results.forEach((result) => {
|
|
366
|
-
const row = createEl("tr", body);
|
|
367
|
-
createEl("th", row).innerText = result.name;
|
|
368
|
-
createEl("td", row).innerText = result.meanOpsStr;
|
|
369
|
-
createEl("td", row).innerText = result.totalSamples.toLocaleString();
|
|
370
|
-
createEl("td", row).innerText = comparison.runComparisonToString(result);
|
|
371
|
-
});
|
|
372
|
-
return container;
|
|
373
|
-
}
|
|
374
|
-
function createEl(tagName, parent, options) {
|
|
375
|
-
const element = document.createElement(tagName, options);
|
|
376
|
-
if (parent) parent.appendChild(element);
|
|
377
|
-
return element;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
// src/util/type.ts
|
|
381
|
-
function covariant() {
|
|
382
|
-
return void 0;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// src/util/url/resolveUrl.ts
|
|
386
|
-
function resolveUrl(relative, base) {
|
|
387
|
-
if (relative.indexOf("://") > 0) return relative;
|
|
388
|
-
if (relative.startsWith("//")) {
|
|
389
|
-
const schemeEnd2 = base.indexOf("://");
|
|
390
|
-
return base.substring(0, schemeEnd2 + 1) + relative;
|
|
391
|
-
}
|
|
392
|
-
const schemeEnd = base.indexOf("://") + 3;
|
|
393
|
-
const pathStart = base.indexOf("/", schemeEnd);
|
|
394
|
-
const origin = pathStart === -1 ? base : base.substring(0, pathStart);
|
|
395
|
-
if (relative.startsWith("/")) return origin + relative;
|
|
396
|
-
if (relative === "") return base;
|
|
397
|
-
const basePath = pathStart === -1 ? "/" : base.substring(pathStart);
|
|
398
|
-
const lastSlash = basePath.lastIndexOf("/");
|
|
399
|
-
const dir = basePath.substring(0, lastSlash + 1);
|
|
400
|
-
return origin + resolveDots(dir + relative);
|
|
401
|
-
}
|
|
402
|
-
function resolveDots(path) {
|
|
403
|
-
if (path.indexOf(".") === -1) return path;
|
|
404
|
-
const parts = path.split("/");
|
|
405
|
-
const out = [];
|
|
406
|
-
for (let i = 0; i < parts.length; i++) {
|
|
407
|
-
const p = parts[i];
|
|
408
|
-
if (p === "..") {
|
|
409
|
-
if (out.length > 1) out.pop();
|
|
410
|
-
} else if (p !== ".") {
|
|
411
|
-
out.push(p);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
return out.join("/");
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// src/error/ErrorOrigin.ts
|
|
418
|
-
var ErrorOrigin = {
|
|
419
|
-
/**
|
|
420
|
-
* The error originated from Vinyl and was reported from the uncaught exception or promise
|
|
421
|
-
* rejection handlers.
|
|
422
|
-
*/
|
|
423
|
-
UNCAUGHT: "uncaught",
|
|
424
|
-
/**
|
|
425
|
-
* The error originated from Vinyl and was caught.
|
|
426
|
-
*/
|
|
427
|
-
INTERNAL: "internal",
|
|
428
|
-
/**
|
|
429
|
-
* A Vinyl interface was used incorrectly by a consumer.
|
|
430
|
-
*/
|
|
431
|
-
API: "api",
|
|
432
|
-
/**
|
|
433
|
-
* The error originated from a failed service call (500 errors).
|
|
434
|
-
*/
|
|
435
|
-
SERVICE_EXTERNAL: "serviceExternal",
|
|
436
|
-
/**
|
|
437
|
-
* The error originated from a failed service call (400 errors).
|
|
438
|
-
*/
|
|
439
|
-
SERVICE_INTERNAL: "serviceInternal",
|
|
440
|
-
/**
|
|
441
|
-
* The error originated from a problem playing provided media.
|
|
442
|
-
* The reporter is from a component such as the element, source buffer, media source, etc.
|
|
443
|
-
*/
|
|
444
|
-
MEDIA: "media",
|
|
445
|
-
/**
|
|
446
|
-
* The error originated from a problem parsing input data.
|
|
447
|
-
* Such as a malformed Dash or HLS manifest.
|
|
448
|
-
*/
|
|
449
|
-
PARSING: "parsing",
|
|
450
|
-
/**
|
|
451
|
-
* The error originated from an incompatibility with browser APIs,
|
|
452
|
-
* such as EME.
|
|
453
|
-
*/
|
|
454
|
-
COMPATIBILITY: "compatibility",
|
|
455
|
-
/**
|
|
456
|
-
* The error originated from DRM.
|
|
457
|
-
* This does not include internal or service errors, only errors from the creation of media keys or media key
|
|
458
|
-
* sessions.
|
|
459
|
-
*/
|
|
460
|
-
DRM: "drm"
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
// src/error/ReportableError.ts
|
|
464
|
-
var ReportableError = class _ReportableError extends Error {
|
|
465
|
-
constructor(message, origin = ErrorOrigin.INTERNAL, level = "fatal" /* FATAL */) {
|
|
466
|
-
super(message);
|
|
467
|
-
this.origin = origin;
|
|
468
|
-
this.level = level;
|
|
469
|
-
Object.setPrototypeOf(this, _ReportableError.prototype);
|
|
470
|
-
}
|
|
471
|
-
get [Symbol.toStringTag]() {
|
|
472
|
-
return "ReportableError";
|
|
473
|
-
}
|
|
474
|
-
get name() {
|
|
475
|
-
return this[Symbol.toStringTag];
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* All ReportableError instances must be serializable.
|
|
479
|
-
*/
|
|
480
|
-
toJSON() {
|
|
481
|
-
return {
|
|
482
|
-
level: this.level,
|
|
483
|
-
message: this.message,
|
|
484
|
-
name: this.name,
|
|
485
|
-
origin: this.origin,
|
|
486
|
-
stack: this.stack
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
// src/error/IllegalArgumentError.ts
|
|
492
|
-
var IllegalArgumentError = class _IllegalArgumentError extends ReportableError {
|
|
493
|
-
constructor(message, isInternal = true) {
|
|
494
|
-
super(message, isInternal ? ErrorOrigin.INTERNAL : ErrorOrigin.API);
|
|
495
|
-
this.isInternal = isInternal;
|
|
496
|
-
Object.setPrototypeOf(this, _IllegalArgumentError.prototype);
|
|
497
|
-
}
|
|
498
|
-
get [Symbol.toStringTag]() {
|
|
499
|
-
return "IllegalArgumentError";
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
// src/util/map/map.ts
|
|
504
|
-
function getOrSet(map, key, defaultValue) {
|
|
505
|
-
if (map.has(key)) {
|
|
506
|
-
return map.get(key);
|
|
507
|
-
} else {
|
|
508
|
-
const value = defaultValue(key);
|
|
509
|
-
map.set(key, value);
|
|
510
|
-
return value;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
function flipMap(map) {
|
|
514
|
-
const result = /* @__PURE__ */ new Map();
|
|
515
|
-
for (const [key, value] of map) {
|
|
516
|
-
result.set(value, key);
|
|
517
|
-
}
|
|
518
|
-
return result;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
// src/util/string/string.ts
|
|
522
|
-
var locale = {
|
|
523
|
-
variableNotDefined: "Variable '{name}' is not defined"
|
|
524
|
-
};
|
|
525
|
-
var DEFAULT_SUBSTITUTE_PATTERN = /\{(\w+)}/g;
|
|
526
|
-
function substitute(str, variables, pattern = DEFAULT_SUBSTITUTE_PATTERN) {
|
|
527
|
-
return str.replace(pattern, (_, name) => {
|
|
528
|
-
if (!(name in variables)) {
|
|
529
|
-
throw new IllegalArgumentError(
|
|
530
|
-
locale.variableNotDefined.replace("{name}", String(name))
|
|
531
|
-
);
|
|
532
|
-
}
|
|
533
|
-
return String(variables[name]);
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
var predefinedDecodeEntities = /* @__PURE__ */ new Map([
|
|
537
|
-
["apos", "'"],
|
|
538
|
-
["amp", "&"],
|
|
539
|
-
["lt", "<"],
|
|
540
|
-
["gt", ">"],
|
|
541
|
-
["quot", '"']
|
|
542
|
-
]);
|
|
543
|
-
var standardEntityValueToNames = flipMap(predefinedDecodeEntities);
|
|
544
|
-
|
|
545
|
-
// src/util/set/set.ts
|
|
546
|
-
function union(a, b) {
|
|
547
|
-
return /* @__PURE__ */ new Set([...a, ...b]);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
// src/util/object/object.ts
|
|
551
|
-
function ownKeys(obj) {
|
|
552
|
-
if (!obj) return /* @__PURE__ */ new Set();
|
|
553
|
-
if (typeof Reflect !== "undefined")
|
|
554
|
-
return new Set(Reflect.ownKeys(obj));
|
|
555
|
-
const properties = /* @__PURE__ */ new Set();
|
|
556
|
-
Object.getOwnPropertyNames(obj).forEach((item) => properties.add(item));
|
|
557
|
-
Object.getOwnPropertySymbols(obj).forEach((item) => properties.add(item));
|
|
558
|
-
return properties;
|
|
559
|
-
}
|
|
560
|
-
function isPlainObject(value) {
|
|
561
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
562
|
-
return false;
|
|
563
|
-
const proto = Object.getPrototypeOf(value);
|
|
564
|
-
return !proto || !Object.getPrototypeOf(proto);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
// src/util/serialization/json.ts
|
|
568
|
-
function toJson(value) {
|
|
569
|
-
return toJsonInternal(value, /* @__PURE__ */ new Set());
|
|
570
|
-
}
|
|
571
|
-
function toJsonInternal(value, visited) {
|
|
572
|
-
switch (typeof value) {
|
|
573
|
-
case "object":
|
|
574
|
-
return objectToJsonInternal(value, visited);
|
|
575
|
-
case "undefined":
|
|
576
|
-
case "boolean":
|
|
577
|
-
case "number":
|
|
578
|
-
case "string":
|
|
579
|
-
return value;
|
|
580
|
-
case "function":
|
|
581
|
-
return `[function ${value.name}]`;
|
|
582
|
-
case "symbol":
|
|
583
|
-
return `[symbol ${value.toString().slice(7, -1)}]`;
|
|
584
|
-
case "bigint":
|
|
585
|
-
return value.toString();
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
function objectToJsonInternal(value, visited) {
|
|
589
|
-
if (value == null) return value;
|
|
590
|
-
if (visited.has(value)) return `<circular reference: ${String(value)}>`;
|
|
591
|
-
visited.add(value);
|
|
592
|
-
if ("toJSON" in value && typeof value.toJSON === "function")
|
|
593
|
-
return value.toJSON();
|
|
594
|
-
if (value instanceof Set) {
|
|
595
|
-
return Array.from(value).map((e) => toJsonInternal(e, visited));
|
|
596
|
-
} else if (Array.isArray(value)) {
|
|
597
|
-
return value.map((e) => toJsonInternal(e, visited));
|
|
598
|
-
} else {
|
|
599
|
-
if (isPlainObject(value)) {
|
|
600
|
-
const o = {};
|
|
601
|
-
for (const key in value) {
|
|
602
|
-
o[key] = toJsonInternal(value[key], visited);
|
|
603
|
-
}
|
|
604
|
-
return o;
|
|
605
|
-
} else if (value instanceof Error) {
|
|
606
|
-
return {
|
|
607
|
-
name: value.name,
|
|
608
|
-
message: value.message,
|
|
609
|
-
stack: value.stack
|
|
610
|
-
};
|
|
611
|
-
} else {
|
|
612
|
-
return value.toString();
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
// src/util/collection/LinkedList.ts
|
|
618
|
-
var LinkedList = class {
|
|
619
|
-
constructor() {
|
|
620
|
-
__publicField(this, "_head", null);
|
|
621
|
-
__publicField(this, "_tail", null);
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Returns the current head.
|
|
625
|
-
*/
|
|
626
|
-
get head() {
|
|
627
|
-
return this._head;
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* Returns the current tail.
|
|
631
|
-
*/
|
|
632
|
-
get tail() {
|
|
633
|
-
return this._tail;
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Returns true if the list is empty.
|
|
637
|
-
*/
|
|
638
|
-
get empty() {
|
|
639
|
-
return this._head === null;
|
|
640
|
-
}
|
|
641
|
-
/**
|
|
642
|
-
* Creates a new node for the given value, adding it to the end of the list.
|
|
643
|
-
*
|
|
644
|
-
* @param value
|
|
645
|
-
* @return Returns the newly created node.
|
|
646
|
-
*/
|
|
647
|
-
push(value) {
|
|
648
|
-
const node = {
|
|
649
|
-
previous: this._tail,
|
|
650
|
-
value,
|
|
651
|
-
removed: false,
|
|
652
|
-
next: null
|
|
653
|
-
};
|
|
654
|
-
this.pushNode(node);
|
|
655
|
-
return node;
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* Appends all given values to the end of this list.
|
|
659
|
-
*
|
|
660
|
-
* @param values
|
|
661
|
-
*/
|
|
662
|
-
pushAll(...values) {
|
|
663
|
-
for (const value of values) {
|
|
664
|
-
this.push(value);
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
/**
|
|
668
|
-
* Appends the given node to the tail of this list.
|
|
669
|
-
* If the node is already at the tail, it will no-op.
|
|
670
|
-
* If the node is in this list, it will be removed.
|
|
671
|
-
*
|
|
672
|
-
* @param node The node to add or move to the tail of this list.
|
|
673
|
-
*/
|
|
674
|
-
pushNode(node) {
|
|
675
|
-
if (this._tail === node) return;
|
|
676
|
-
this.remove(node);
|
|
677
|
-
node.removed = false;
|
|
678
|
-
node.next = null;
|
|
679
|
-
node.previous = this._tail;
|
|
680
|
-
if (this._tail) this._tail.next = node;
|
|
681
|
-
this._tail = node;
|
|
682
|
-
if (!this._head) this._head = node;
|
|
169
|
+
/**
|
|
170
|
+
* Appends the given node to the tail of this list.
|
|
171
|
+
* If the node is already at the tail, it will no-op.
|
|
172
|
+
* If the node is in this list, it will be removed.
|
|
173
|
+
*
|
|
174
|
+
* @param node The node to add or move to the tail of this list.
|
|
175
|
+
*/
|
|
176
|
+
pushNode(node) {
|
|
177
|
+
if (this._tail === node) return;
|
|
178
|
+
this.remove(node);
|
|
179
|
+
node.removed = false;
|
|
180
|
+
node.next = null;
|
|
181
|
+
node.previous = this._tail;
|
|
182
|
+
if (this._tail) this._tail.next = node;
|
|
183
|
+
this._tail = node;
|
|
184
|
+
if (!this._head) this._head = node;
|
|
683
185
|
}
|
|
684
186
|
/**
|
|
685
187
|
* Removes the last node (the tail), returning it.
|
|
@@ -975,6 +477,29 @@
|
|
|
975
477
|
return new SignalImpl();
|
|
976
478
|
}
|
|
977
479
|
|
|
480
|
+
// src/util/map/map.ts
|
|
481
|
+
function getOrSet(map, key, defaultValue) {
|
|
482
|
+
if (map.has(key)) {
|
|
483
|
+
return map.get(key);
|
|
484
|
+
} else {
|
|
485
|
+
const value = defaultValue(key);
|
|
486
|
+
map.set(key, value);
|
|
487
|
+
return value;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
function flipMap(map) {
|
|
491
|
+
const result = /* @__PURE__ */ new Map();
|
|
492
|
+
for (const [key, value] of map) {
|
|
493
|
+
result.set(value, key);
|
|
494
|
+
}
|
|
495
|
+
return result;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// src/util/type.ts
|
|
499
|
+
function covariant() {
|
|
500
|
+
return void 0;
|
|
501
|
+
}
|
|
502
|
+
|
|
978
503
|
// src/logging/LogTarget.ts
|
|
979
504
|
var counter = 0;
|
|
980
505
|
function createLogPrefix(target) {
|
|
@@ -1010,816 +535,1233 @@
|
|
|
1010
535
|
var _a;
|
|
1011
536
|
(_a = this.signals.get(type)) == null ? void 0 : _a.dispatch(event);
|
|
1012
537
|
}
|
|
1013
|
-
dispose() {
|
|
1014
|
-
for (const signal2 of this.signals.values()) signal2.dispose();
|
|
1015
|
-
this.signals.clear();
|
|
538
|
+
dispose() {
|
|
539
|
+
for (const signal2 of this.signals.values()) signal2.dispose();
|
|
540
|
+
this.signals.clear();
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
// src/util/collection/array.ts
|
|
545
|
+
function remove(array, element) {
|
|
546
|
+
const index = array.indexOf(element);
|
|
547
|
+
if (index === -1) return false;
|
|
548
|
+
array.splice(index, 1);
|
|
549
|
+
return true;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// src/util/iteration/iterable.ts
|
|
553
|
+
function mapIter(iterable, transform) {
|
|
554
|
+
const it2 = iterable[Symbol.iterator]();
|
|
555
|
+
return {
|
|
556
|
+
[Symbol.iterator]() {
|
|
557
|
+
return mapIter(iterable, transform);
|
|
558
|
+
},
|
|
559
|
+
next: () => {
|
|
560
|
+
const result = it2.next();
|
|
561
|
+
if (result.done) return result;
|
|
562
|
+
return {
|
|
563
|
+
value: transform(result.value),
|
|
564
|
+
done: false
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// src/error/IllegalStateError.ts
|
|
571
|
+
var IllegalStateError = class _IllegalStateError extends ReportableError {
|
|
572
|
+
get [Symbol.toStringTag]() {
|
|
573
|
+
return "IllegalStateError";
|
|
574
|
+
}
|
|
575
|
+
constructor(message) {
|
|
576
|
+
super(message);
|
|
577
|
+
Object.setPrototypeOf(this, _IllegalStateError.prototype);
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
// src/util/collection/LruCache.ts
|
|
582
|
+
var LruCache = class {
|
|
583
|
+
constructor(initialCapacity) {
|
|
584
|
+
/**
|
|
585
|
+
* A map of the list nodes.
|
|
586
|
+
*
|
|
587
|
+
* @private
|
|
588
|
+
*/
|
|
589
|
+
__publicField(this, "cache", /* @__PURE__ */ new Map());
|
|
590
|
+
/**
|
|
591
|
+
* Most recently used elements are at the tail, least recently used are at the head.
|
|
592
|
+
* @private
|
|
593
|
+
*/
|
|
594
|
+
__publicField(this, "list", new LinkedList());
|
|
595
|
+
/**
|
|
596
|
+
* An element is about to be removed. Should return true if the element may be evicted,
|
|
597
|
+
* otherwise false.
|
|
598
|
+
* If false is returned for all elements, an IllegalStateError is thrown.
|
|
599
|
+
*/
|
|
600
|
+
__publicField(this, "onEvicting", null);
|
|
601
|
+
/**
|
|
602
|
+
* When an element is added when at capacity, the least recently used element will be removed.
|
|
603
|
+
* This callback can be set to be notified with the element being evicted, which may be used
|
|
604
|
+
* for disposal.
|
|
605
|
+
*/
|
|
606
|
+
__publicField(this, "onEvict", null);
|
|
607
|
+
__publicField(this, "_capacity", 0);
|
|
608
|
+
this._capacity = initialCapacity;
|
|
609
|
+
}
|
|
610
|
+
get capacity() {
|
|
611
|
+
return this._capacity;
|
|
612
|
+
}
|
|
613
|
+
set capacity(value) {
|
|
614
|
+
this._capacity = value;
|
|
615
|
+
while (this.cache.size > this.capacity) {
|
|
616
|
+
this.evictLeastRecentlyUsed();
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* @returns the number of elements in the Map.
|
|
621
|
+
*/
|
|
622
|
+
get size() {
|
|
623
|
+
return this.cache.size;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* @returns boolean indicating whether an element with the specified key exists or not.
|
|
627
|
+
*/
|
|
628
|
+
has(key) {
|
|
629
|
+
return this.cache.has(key);
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Returns the mapped value for the given key, and moves the element to the most recently
|
|
633
|
+
* used position.
|
|
634
|
+
*
|
|
635
|
+
* @returns Returns the element associated with the given key, or undefined if no such
|
|
636
|
+
* element exists.
|
|
637
|
+
*/
|
|
638
|
+
get(key) {
|
|
639
|
+
const node = this.cache.get(key);
|
|
640
|
+
if (!node) return void 0;
|
|
641
|
+
this.list.pushNode(node);
|
|
642
|
+
return node.value[1];
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Adds a new element with a specified key and value to the Map. If an element with the
|
|
646
|
+
* same key already exists, the element will be updated and position moved to most recently
|
|
647
|
+
* used.
|
|
648
|
+
*/
|
|
649
|
+
set(key, value) {
|
|
650
|
+
if (this.has(key)) {
|
|
651
|
+
const node = this.cache.get(key);
|
|
652
|
+
node.value[1] = value;
|
|
653
|
+
this.list.pushNode(node);
|
|
654
|
+
} else {
|
|
655
|
+
const node = this.list.push([key, value]);
|
|
656
|
+
this.cache.set(key, node);
|
|
657
|
+
if (this.cache.size > this.capacity) {
|
|
658
|
+
this.evictLeastRecentlyUsed();
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
return this;
|
|
662
|
+
}
|
|
663
|
+
evictLeastRecentlyUsed() {
|
|
664
|
+
var _a, _b, _c;
|
|
665
|
+
let node = this.list.head;
|
|
666
|
+
while (node) {
|
|
667
|
+
const [key2, value2] = node.value;
|
|
668
|
+
const allowed = (_b = (_a = this.onEvicting) == null ? void 0 : _a.call(null, value2, key2, this)) != null ? _b : true;
|
|
669
|
+
if (allowed) break;
|
|
670
|
+
node = node.next;
|
|
671
|
+
}
|
|
672
|
+
if (!node)
|
|
673
|
+
throw new IllegalStateError(
|
|
674
|
+
"onEvicting returned false for all elements"
|
|
675
|
+
);
|
|
676
|
+
const [key, value] = node.value;
|
|
677
|
+
this.list.remove(node);
|
|
678
|
+
this.cache.delete(node.value[0]);
|
|
679
|
+
(_c = this.onEvict) == null ? void 0 : _c.call(null, value, key, this);
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Clears all elements from the cache.
|
|
683
|
+
*/
|
|
684
|
+
clear() {
|
|
685
|
+
this.list.clear();
|
|
686
|
+
this.cache.clear();
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* @returns true if an element in the Map existed and has been removed, or false if the element does not exist.
|
|
690
|
+
*/
|
|
691
|
+
delete(key) {
|
|
692
|
+
if (!this.has(key)) return false;
|
|
693
|
+
const node = this.cache.get(key);
|
|
694
|
+
this.cache.delete(key);
|
|
695
|
+
this.list.remove(node);
|
|
696
|
+
return true;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Executes a provided function once per each key/value pair in the Map, in insertion order.
|
|
700
|
+
*
|
|
701
|
+
* @param callback A callback to invoke for every element in the cache.
|
|
702
|
+
* @param thisArg Value to use as this when executing callback
|
|
703
|
+
*/
|
|
704
|
+
forEach(callback, thisArg) {
|
|
705
|
+
return this.list.forEach((entry) => {
|
|
706
|
+
callback.call(thisArg, entry[1], entry[0], this);
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Returns an iterable of key, value pairs for every entry in the map.
|
|
711
|
+
*/
|
|
712
|
+
entries() {
|
|
713
|
+
return this[Symbol.iterator]();
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Returns an iterable of keys in the map. This will be ordered from least recently used to
|
|
717
|
+
* most.
|
|
718
|
+
*/
|
|
719
|
+
keys() {
|
|
720
|
+
return mapIter(this.list, ([key]) => key);
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Returns an iterable of values in the map. This will be ordered from least recently used to
|
|
724
|
+
* most.
|
|
725
|
+
*/
|
|
726
|
+
values() {
|
|
727
|
+
return mapIter(this.list, ([, value]) => value);
|
|
728
|
+
}
|
|
729
|
+
[Symbol.iterator]() {
|
|
730
|
+
return this.list[Symbol.iterator]();
|
|
731
|
+
}
|
|
732
|
+
get [Symbol.toStringTag]() {
|
|
733
|
+
return "LruCache";
|
|
1016
734
|
}
|
|
1017
735
|
};
|
|
1018
736
|
|
|
1019
|
-
// src/util/
|
|
1020
|
-
function
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
737
|
+
// src/util/fun/memoize.ts
|
|
738
|
+
function memoize(inner, keyProvider, capacity = 500) {
|
|
739
|
+
if (!keyProvider) {
|
|
740
|
+
let cached = false;
|
|
741
|
+
let value = void 0;
|
|
742
|
+
const memoized = () => {
|
|
743
|
+
if (!cached) {
|
|
744
|
+
cached = true;
|
|
745
|
+
value = inner();
|
|
746
|
+
}
|
|
747
|
+
return value;
|
|
748
|
+
};
|
|
749
|
+
return Object.assign(
|
|
750
|
+
memoized,
|
|
751
|
+
{
|
|
752
|
+
clear: () => {
|
|
753
|
+
cached = false;
|
|
754
|
+
value = void 0;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
} else if (capacity === 0) {
|
|
759
|
+
const memoized = (...args) => inner(...args);
|
|
760
|
+
return Object.assign(
|
|
761
|
+
memoized,
|
|
762
|
+
{
|
|
763
|
+
clear: () => {
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
);
|
|
767
|
+
} else if (capacity === 1) {
|
|
768
|
+
let hasValue = false;
|
|
769
|
+
let cachedKey;
|
|
770
|
+
let cachedValue;
|
|
771
|
+
const memoized = (...args) => {
|
|
772
|
+
const key = keyProvider(...args);
|
|
773
|
+
if (!hasValue || cachedKey !== key) {
|
|
774
|
+
hasValue = true;
|
|
775
|
+
cachedKey = key;
|
|
776
|
+
cachedValue = inner(...args);
|
|
777
|
+
}
|
|
778
|
+
return cachedValue;
|
|
779
|
+
};
|
|
780
|
+
return Object.assign(
|
|
781
|
+
memoized,
|
|
782
|
+
{
|
|
783
|
+
clear: () => {
|
|
784
|
+
hasValue = false;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
);
|
|
788
|
+
} else {
|
|
789
|
+
const cache = new LruCache(capacity);
|
|
790
|
+
const memoized = (...args) => {
|
|
791
|
+
const key = keyProvider(...args);
|
|
792
|
+
return getOrSet(cache, key, () => inner(...args));
|
|
793
|
+
};
|
|
794
|
+
return Object.assign(
|
|
795
|
+
memoized,
|
|
796
|
+
{
|
|
797
|
+
clear: () => {
|
|
798
|
+
cache.clear();
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
);
|
|
802
|
+
}
|
|
1025
803
|
}
|
|
1026
804
|
|
|
1027
|
-
// src/util/
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
}
|
|
1031
|
-
var
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
];
|
|
1042
|
-
function isTypedArray(value) {
|
|
1043
|
-
return typedArrayTypes.some((type) => value instanceof type);
|
|
805
|
+
// src/util/string/string.ts
|
|
806
|
+
var locale = {
|
|
807
|
+
variableNotDefined: "Variable '{name}' is not defined"
|
|
808
|
+
};
|
|
809
|
+
var DEFAULT_SUBSTITUTE_PATTERN = /\{(\w+)}/g;
|
|
810
|
+
function substitute(str, variables, pattern = DEFAULT_SUBSTITUTE_PATTERN) {
|
|
811
|
+
return str.replace(pattern, (_, name) => {
|
|
812
|
+
if (!(name in variables)) {
|
|
813
|
+
throw new IllegalArgumentError(
|
|
814
|
+
locale.variableNotDefined.replace("{name}", String(name))
|
|
815
|
+
);
|
|
816
|
+
}
|
|
817
|
+
return String(variables[name]);
|
|
818
|
+
});
|
|
1044
819
|
}
|
|
820
|
+
var predefinedDecodeEntities = /* @__PURE__ */ new Map([
|
|
821
|
+
["apos", "'"],
|
|
822
|
+
["amp", "&"],
|
|
823
|
+
["lt", "<"],
|
|
824
|
+
["gt", ">"],
|
|
825
|
+
["quot", '"']
|
|
826
|
+
]);
|
|
827
|
+
var standardEntityValueToNames = flipMap(predefinedDecodeEntities);
|
|
1045
828
|
|
|
1046
|
-
// src/core/
|
|
1047
|
-
function
|
|
1048
|
-
return value != null && typeof value
|
|
829
|
+
// src/core/disposable.ts
|
|
830
|
+
function isDisposable(value) {
|
|
831
|
+
return value != null && typeof value.dispose === "function" && value.dispose.length === 0;
|
|
1049
832
|
}
|
|
1050
833
|
|
|
1051
|
-
// src/
|
|
1052
|
-
var
|
|
1053
|
-
cyclicRefError: "Cyclic reference found at: {path}",
|
|
1054
|
-
mergeReferenceError: `No merge rule found at {path} for "{source}" and reference copy not allowed`
|
|
1055
|
-
};
|
|
1056
|
-
function mergeDeep(sources, options) {
|
|
1057
|
-
if (!sources.length) return void 0;
|
|
1058
|
-
const finalOpts = __spreadValues(__spreadValues({}, defaultMergeOptions), options);
|
|
1059
|
-
const stack = new PropStack();
|
|
1060
|
-
const n = sources.length;
|
|
1061
|
-
if (n === 1)
|
|
1062
|
-
return _mergeDeep(void 0, sources[0], stack, 0, finalOpts);
|
|
1063
|
-
let out = _mergeDeep(sources[0], sources[1], stack, 1, finalOpts);
|
|
1064
|
-
for (let i = 2; i < n; i++) {
|
|
1065
|
-
out = _mergeDeep(out, sources[i], stack, i, finalOpts);
|
|
1066
|
-
}
|
|
1067
|
-
return out;
|
|
1068
|
-
}
|
|
1069
|
-
var PropStack = class {
|
|
834
|
+
// src/global/globalRegistry.ts
|
|
835
|
+
var GlobalRegistry = class {
|
|
1070
836
|
constructor() {
|
|
1071
|
-
|
|
1072
|
-
* Object references for sourceA.
|
|
1073
|
-
*/
|
|
1074
|
-
__publicField(this, "refsA", /* @__PURE__ */ new Set());
|
|
1075
|
-
/**
|
|
1076
|
-
* Object references for sourceB.
|
|
1077
|
-
*/
|
|
1078
|
-
__publicField(this, "refsB", /* @__PURE__ */ new Set());
|
|
1079
|
-
__publicField(this, "propStack", []);
|
|
837
|
+
__publicField(this, "registry", []);
|
|
1080
838
|
}
|
|
1081
839
|
/**
|
|
1082
|
-
*
|
|
840
|
+
* Returns the number of references currently in the registry.
|
|
1083
841
|
*/
|
|
1084
|
-
get
|
|
1085
|
-
return this.
|
|
842
|
+
get size() {
|
|
843
|
+
return this.registry.length;
|
|
1086
844
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
845
|
+
/**
|
|
846
|
+
* Registers an initializer that will be invoked during global state initialization.
|
|
847
|
+
* @param initializer
|
|
848
|
+
*/
|
|
849
|
+
register(initializer) {
|
|
850
|
+
this.registry.push(initializer);
|
|
851
|
+
return initializer;
|
|
1091
852
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
853
|
+
/**
|
|
854
|
+
* Removes a global ref from the registry.
|
|
855
|
+
* May be called at any time.
|
|
856
|
+
* @param ref
|
|
857
|
+
* @return Returns true if the global ref was removed.
|
|
858
|
+
*/
|
|
859
|
+
unregister(ref) {
|
|
860
|
+
return remove(this.registry, ref);
|
|
1096
861
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
862
|
+
/**
|
|
863
|
+
* Resets all registered initializers and sets this registry back to its pre-initialized state.
|
|
864
|
+
* This is typically only done within unit tests, but may be called if all players are
|
|
865
|
+
* disposed and the consumer intends to teardown global state.
|
|
866
|
+
*/
|
|
867
|
+
reset() {
|
|
868
|
+
for (const registryElement of this.registry) {
|
|
869
|
+
registryElement.reset();
|
|
1103
870
|
}
|
|
1104
|
-
refSet.add(source);
|
|
1105
871
|
}
|
|
1106
872
|
};
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
}
|
|
873
|
+
var _registry = null;
|
|
874
|
+
function getGlobalRegistry() {
|
|
875
|
+
if (!_registry) _registry = new GlobalRegistry();
|
|
876
|
+
return _registry;
|
|
877
|
+
}
|
|
878
|
+
var globalRefDebug = false;
|
|
879
|
+
var GlobalRefImpl = class {
|
|
880
|
+
constructor(defaultInitializer) {
|
|
881
|
+
__publicField(this, "defaultInitializer", defaultInitializer);
|
|
882
|
+
__publicField(this, "_value");
|
|
883
|
+
__publicField(this, "_initialized", false);
|
|
884
|
+
__publicField(this, "constructing", false);
|
|
885
|
+
__publicField(this, "initializer");
|
|
886
|
+
__publicField(this, "lastInitStack", null);
|
|
887
|
+
this.initializer = defaultInitializer;
|
|
1123
888
|
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
throw new MergeReferenceError(propStack.currentPath, sourceB);
|
|
889
|
+
get initialized() {
|
|
890
|
+
return this._initialized;
|
|
1127
891
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
constructor(propPath, source) {
|
|
1132
|
-
super(
|
|
1133
|
-
substitute(locale2.mergeReferenceError, {
|
|
1134
|
-
path: propPath,
|
|
1135
|
-
source
|
|
1136
|
-
})
|
|
1137
|
-
);
|
|
1138
|
-
Object.setPrototypeOf(this, _MergeReferenceError.prototype);
|
|
892
|
+
get value() {
|
|
893
|
+
this.initialize();
|
|
894
|
+
return this._value;
|
|
1139
895
|
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
896
|
+
reset() {
|
|
897
|
+
this.initializer = this.defaultInitializer;
|
|
898
|
+
if (!this._initialized) return;
|
|
899
|
+
this.assertNotConstructing();
|
|
900
|
+
this._initialized = false;
|
|
901
|
+
this.lastInitStack = null;
|
|
902
|
+
if (isDisposable(this._value)) {
|
|
903
|
+
this._value.dispose();
|
|
904
|
+
}
|
|
905
|
+
this._value = void 0;
|
|
1147
906
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
out.push(merge(void 0, element, out.length));
|
|
1158
|
-
}
|
|
907
|
+
initialize() {
|
|
908
|
+
if (this._initialized) return;
|
|
909
|
+
this.assertNotConstructing();
|
|
910
|
+
this.constructing = true;
|
|
911
|
+
try {
|
|
912
|
+
this._value = this.initializer();
|
|
913
|
+
} catch (error) {
|
|
914
|
+
this.constructing = false;
|
|
915
|
+
throw error;
|
|
1159
916
|
}
|
|
1160
|
-
|
|
1161
|
-
|
|
917
|
+
this.constructing = false;
|
|
918
|
+
this._initialized = true;
|
|
919
|
+
if (globalRefDebug) {
|
|
920
|
+
this.lastInitStack = new Error("globalRef initialized").stack;
|
|
1162
921
|
}
|
|
1163
|
-
return out;
|
|
1164
922
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
out[key] = merge(void 0, sourceA[key], key);
|
|
1177
|
-
} else {
|
|
1178
|
-
out[key] = merge(void 0, sourceB[key], key);
|
|
923
|
+
set(newInitializer) {
|
|
924
|
+
this.assertNotInitialized();
|
|
925
|
+
const overriddenInitializer = () => {
|
|
926
|
+
return newInitializer(this.defaultInitializer);
|
|
927
|
+
};
|
|
928
|
+
this.initializer = overriddenInitializer;
|
|
929
|
+
return new GlobalRefOverride(
|
|
930
|
+
this,
|
|
931
|
+
overriddenInitializer,
|
|
932
|
+
(newInitializer2) => {
|
|
933
|
+
this.initializer = newInitializer2;
|
|
1179
934
|
}
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
assertNotInitialized() {
|
|
938
|
+
if (this._initialized) {
|
|
939
|
+
const detail = this.lastInitStack ? `
|
|
940
|
+
Last initialized at:
|
|
941
|
+
${this.lastInitStack}` : "";
|
|
942
|
+
throw new IllegalStateError(`Cannot call when initialized${detail}`);
|
|
1180
943
|
}
|
|
1181
|
-
return out;
|
|
1182
944
|
}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
return object instanceof RegExp;
|
|
1187
|
-
},
|
|
1188
|
-
merge(_1, sourceB, _2) {
|
|
1189
|
-
return new RegExp(sourceB.source, sourceB.flags);
|
|
945
|
+
assertNotConstructing() {
|
|
946
|
+
if (this.constructing)
|
|
947
|
+
throw new IllegalStateError("Cannot call during construction");
|
|
1190
948
|
}
|
|
1191
949
|
};
|
|
1192
|
-
var
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
950
|
+
var GlobalRefOverride = class _GlobalRefOverride {
|
|
951
|
+
constructor(original, defaultInitializer, setInitializer) {
|
|
952
|
+
__publicField(this, "original", original);
|
|
953
|
+
__publicField(this, "defaultInitializer", defaultInitializer);
|
|
954
|
+
__publicField(this, "setInitializer", setInitializer);
|
|
955
|
+
__publicField(this, "initializer");
|
|
956
|
+
this.initializer = defaultInitializer;
|
|
1198
957
|
}
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
matches(object) {
|
|
1202
|
-
return object instanceof Map;
|
|
1203
|
-
},
|
|
1204
|
-
merge(sourceA, sourceB, merge) {
|
|
1205
|
-
var _a;
|
|
1206
|
-
const out = /* @__PURE__ */ new Map();
|
|
1207
|
-
for (const key of /* @__PURE__ */ new Set([
|
|
1208
|
-
...(_a = sourceA == null ? void 0 : sourceA.keys()) != null ? _a : [],
|
|
1209
|
-
...sourceB.keys()
|
|
1210
|
-
])) {
|
|
1211
|
-
if (sourceB.has(key) && (sourceA == null ? void 0 : sourceA.has(key))) {
|
|
1212
|
-
out.set(key, merge(sourceA.get(key), sourceB.get(key), key));
|
|
1213
|
-
} else if (sourceA == null ? void 0 : sourceA.has(key)) {
|
|
1214
|
-
out.set(key, merge(void 0, sourceA.get(key), key));
|
|
1215
|
-
} else {
|
|
1216
|
-
out.set(key, merge(void 0, sourceB.get(key), key));
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
return out;
|
|
958
|
+
get initialized() {
|
|
959
|
+
return this.original.initialized;
|
|
1220
960
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
961
|
+
get value() {
|
|
962
|
+
return this.original.value;
|
|
963
|
+
}
|
|
964
|
+
initialize() {
|
|
965
|
+
this.setInitializer(this.initializer);
|
|
966
|
+
this.original.initialize();
|
|
967
|
+
}
|
|
968
|
+
reset() {
|
|
969
|
+
this.initializer = this.defaultInitializer;
|
|
970
|
+
this.original.reset();
|
|
971
|
+
this.setInitializer(this.initializer);
|
|
972
|
+
}
|
|
973
|
+
set(newInitializer) {
|
|
974
|
+
const overriddenInitializer = () => {
|
|
975
|
+
return newInitializer(this.defaultInitializer);
|
|
976
|
+
};
|
|
977
|
+
this.initializer = overriddenInitializer;
|
|
978
|
+
this.setInitializer(overriddenInitializer);
|
|
979
|
+
return new _GlobalRefOverride(
|
|
980
|
+
this,
|
|
981
|
+
overriddenInitializer,
|
|
982
|
+
this.setInitializer
|
|
1234
983
|
);
|
|
1235
984
|
}
|
|
1236
985
|
};
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
986
|
+
function globalRef(init) {
|
|
987
|
+
return getGlobalRegistry().register(new GlobalRefImpl(init));
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
// src/core/cloneable.ts
|
|
991
|
+
function isCloneable(value) {
|
|
992
|
+
return value != null && typeof value === "object" && "clone" in value && typeof value.clone === "function" && value.clone.length === 0;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// src/util/object/object.ts
|
|
996
|
+
function ownKeys(obj) {
|
|
997
|
+
if (!obj) return /* @__PURE__ */ new Set();
|
|
998
|
+
if (typeof Reflect !== "undefined")
|
|
999
|
+
return new Set(Reflect.ownKeys(obj));
|
|
1000
|
+
const properties = /* @__PURE__ */ new Set();
|
|
1001
|
+
Object.getOwnPropertyNames(obj).forEach((item) => properties.add(item));
|
|
1002
|
+
Object.getOwnPropertySymbols(obj).forEach((item) => properties.add(item));
|
|
1003
|
+
return properties;
|
|
1004
|
+
}
|
|
1005
|
+
function isPlainObject(value) {
|
|
1006
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
1007
|
+
return false;
|
|
1008
|
+
const proto = Object.getPrototypeOf(value);
|
|
1009
|
+
return !proto || !Object.getPrototypeOf(proto);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
// src/util/serialization/json.ts
|
|
1013
|
+
function toJson(value) {
|
|
1014
|
+
return toJsonInternal(value, /* @__PURE__ */ new Set());
|
|
1015
|
+
}
|
|
1016
|
+
function toJsonInternal(value, visited) {
|
|
1017
|
+
switch (typeof value) {
|
|
1018
|
+
case "object":
|
|
1019
|
+
return objectToJsonInternal(value, visited);
|
|
1020
|
+
case "undefined":
|
|
1021
|
+
case "boolean":
|
|
1022
|
+
case "number":
|
|
1023
|
+
case "string":
|
|
1024
|
+
return value;
|
|
1025
|
+
case "function":
|
|
1026
|
+
return `[function ${value.name}]`;
|
|
1027
|
+
case "symbol":
|
|
1028
|
+
return `[symbol ${value.toString().slice(7, -1)}]`;
|
|
1029
|
+
case "bigint":
|
|
1030
|
+
return value.toString();
|
|
1243
1031
|
}
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
return
|
|
1032
|
+
}
|
|
1033
|
+
function objectToJsonInternal(value, visited) {
|
|
1034
|
+
if (value == null) return value;
|
|
1035
|
+
if (visited.has(value)) return `<circular reference: ${String(value)}>`;
|
|
1036
|
+
visited.add(value);
|
|
1037
|
+
if ("toJSON" in value && typeof value.toJSON === "function")
|
|
1038
|
+
return value.toJSON();
|
|
1039
|
+
if (value instanceof Set) {
|
|
1040
|
+
return Array.from(value).map((e) => toJsonInternal(e, visited));
|
|
1041
|
+
} else if (Array.isArray(value)) {
|
|
1042
|
+
return value.map((e) => toJsonInternal(e, visited));
|
|
1043
|
+
} else {
|
|
1044
|
+
if (isPlainObject(value)) {
|
|
1045
|
+
const o = {};
|
|
1046
|
+
for (const key in value) {
|
|
1047
|
+
o[key] = toJsonInternal(value[key], visited);
|
|
1048
|
+
}
|
|
1049
|
+
return o;
|
|
1050
|
+
} else if (value instanceof Error) {
|
|
1051
|
+
return {
|
|
1052
|
+
name: value.name,
|
|
1053
|
+
message: value.message,
|
|
1054
|
+
stack: value.stack
|
|
1055
|
+
};
|
|
1056
|
+
} else {
|
|
1057
|
+
return value.toString();
|
|
1058
|
+
}
|
|
1251
1059
|
}
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
setMergeRule,
|
|
1263
|
-
typedArrayMergeRule,
|
|
1264
|
-
urlMergeRule
|
|
1265
|
-
]
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// src/global/environment.ts
|
|
1063
|
+
function getLocation() {
|
|
1064
|
+
return typeof location === "object" ? location : defaultLocation;
|
|
1065
|
+
}
|
|
1066
|
+
var defaultLocation = {
|
|
1067
|
+
origin: "",
|
|
1068
|
+
search: "",
|
|
1069
|
+
href: ""
|
|
1266
1070
|
};
|
|
1267
1071
|
|
|
1268
|
-
// src/
|
|
1269
|
-
var
|
|
1072
|
+
// src/util/browser/searchParams.ts
|
|
1073
|
+
var getSearchParams = memoize(
|
|
1074
|
+
(search = getLocationSearch()) => {
|
|
1075
|
+
const url = new URL("about:blank");
|
|
1076
|
+
url.search = search;
|
|
1077
|
+
return url.searchParams;
|
|
1078
|
+
},
|
|
1079
|
+
(search = getLocationSearch()) => search,
|
|
1080
|
+
1
|
|
1081
|
+
);
|
|
1082
|
+
function getLocationSearch() {
|
|
1083
|
+
return getLocation().search;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
// src/logging/getLogLevelFromSearch.ts
|
|
1087
|
+
function getLogLevelFromSearch(search = getLocationSearch(), defaultLevel = 3 /* WARN */) {
|
|
1088
|
+
var _a;
|
|
1089
|
+
const str = getSearchParams(search).get("vinylLogLevel");
|
|
1090
|
+
if (!str) return defaultLevel;
|
|
1091
|
+
return (_a = parseLogLevel(str)) != null ? _a : defaultLevel;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// src/logging/Logger.ts
|
|
1095
|
+
var LoggerImpl = class extends EventHostImpl {
|
|
1096
|
+
constructor(logLevel = 1 /* DEBUG */) {
|
|
1097
|
+
super();
|
|
1098
|
+
__publicField(this, "logLevel", logLevel);
|
|
1099
|
+
}
|
|
1270
1100
|
get [Symbol.toStringTag]() {
|
|
1271
|
-
return "
|
|
1101
|
+
return "Logger";
|
|
1272
1102
|
}
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1103
|
+
log(target, level, ...messages) {
|
|
1104
|
+
if (level === 5 /* NONE */ || level < this.logLevel) return;
|
|
1105
|
+
this.dispatch("log", {
|
|
1106
|
+
level,
|
|
1107
|
+
messages: toJson(messages),
|
|
1108
|
+
target
|
|
1109
|
+
});
|
|
1276
1110
|
}
|
|
1277
1111
|
};
|
|
1112
|
+
var loggerRef = globalRef(
|
|
1113
|
+
() => new LoggerImpl(
|
|
1114
|
+
// The logger is initialized to VERBOSE if vinylLogLevel=verbose is in the query string
|
|
1115
|
+
// Otherwise use DEBUG.
|
|
1116
|
+
getLogLevelFromSearch() === 0 /* VERBOSE */ ? 0 /* VERBOSE */ : 1 /* DEBUG */
|
|
1117
|
+
)
|
|
1118
|
+
);
|
|
1119
|
+
function logDebug(target, ...messages) {
|
|
1120
|
+
loggerRef.value.log(target, 1 /* DEBUG */, ...messages);
|
|
1121
|
+
}
|
|
1122
|
+
var strToLogLevel = {
|
|
1123
|
+
verbose: 0 /* VERBOSE */,
|
|
1124
|
+
debug: 1 /* DEBUG */,
|
|
1125
|
+
info: 2 /* INFO */,
|
|
1126
|
+
warn: 3 /* WARN */,
|
|
1127
|
+
error: 4 /* ERROR */,
|
|
1128
|
+
none: 5 /* NONE */
|
|
1129
|
+
};
|
|
1130
|
+
function parseLogLevel(str) {
|
|
1131
|
+
var _a;
|
|
1132
|
+
return (_a = strToLogLevel[str.toLowerCase()]) != null ? _a : null;
|
|
1133
|
+
}
|
|
1278
1134
|
|
|
1279
|
-
// src/
|
|
1280
|
-
function
|
|
1281
|
-
return
|
|
1135
|
+
// src/util/collection/typedArray.ts
|
|
1136
|
+
function cloneTypedArray(array) {
|
|
1137
|
+
return new array.constructor(array);
|
|
1138
|
+
}
|
|
1139
|
+
var typedArrayTypes = [
|
|
1140
|
+
Float32Array,
|
|
1141
|
+
Float64Array,
|
|
1142
|
+
Int16Array,
|
|
1143
|
+
Int32Array,
|
|
1144
|
+
Int8Array,
|
|
1145
|
+
Uint16Array,
|
|
1146
|
+
Uint32Array,
|
|
1147
|
+
Uint8Array,
|
|
1148
|
+
Uint8ClampedArray
|
|
1149
|
+
];
|
|
1150
|
+
function isTypedArray(value) {
|
|
1151
|
+
return typedArrayTypes.some((type) => value instanceof type);
|
|
1282
1152
|
}
|
|
1283
1153
|
|
|
1284
|
-
// src/util/
|
|
1285
|
-
function
|
|
1286
|
-
|
|
1287
|
-
return {
|
|
1288
|
-
[Symbol.iterator]() {
|
|
1289
|
-
return mapIter(iterable, transform);
|
|
1290
|
-
},
|
|
1291
|
-
next: () => {
|
|
1292
|
-
const result = it2.next();
|
|
1293
|
-
if (result.done) return result;
|
|
1294
|
-
return {
|
|
1295
|
-
value: transform(result.value),
|
|
1296
|
-
done: false
|
|
1297
|
-
};
|
|
1298
|
-
}
|
|
1299
|
-
};
|
|
1154
|
+
// src/util/set/set.ts
|
|
1155
|
+
function union(a, b) {
|
|
1156
|
+
return /* @__PURE__ */ new Set([...a, ...b]);
|
|
1300
1157
|
}
|
|
1301
1158
|
|
|
1302
|
-
// src/util/
|
|
1303
|
-
var
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1159
|
+
// src/util/object/mergeDeep.ts
|
|
1160
|
+
var locale2 = {
|
|
1161
|
+
cyclicRefError: "Cyclic reference found at: {path}",
|
|
1162
|
+
mergeReferenceError: `No merge rule found at {path} for "{source}" and reference copy not allowed`
|
|
1163
|
+
};
|
|
1164
|
+
function mergeDeep(sources, options) {
|
|
1165
|
+
if (!sources.length) return void 0;
|
|
1166
|
+
const finalOpts = __spreadValues(__spreadValues({}, defaultMergeOptions), options);
|
|
1167
|
+
const stack = new PropStack();
|
|
1168
|
+
const n = sources.length;
|
|
1169
|
+
if (n === 1)
|
|
1170
|
+
return _mergeDeep(void 0, sources[0], stack, 0, finalOpts);
|
|
1171
|
+
let out = _mergeDeep(sources[0], sources[1], stack, 1, finalOpts);
|
|
1172
|
+
for (let i = 2; i < n; i++) {
|
|
1173
|
+
out = _mergeDeep(out, sources[i], stack, i, finalOpts);
|
|
1174
|
+
}
|
|
1175
|
+
return out;
|
|
1176
|
+
}
|
|
1177
|
+
var PropStack = class {
|
|
1178
|
+
constructor() {
|
|
1316
1179
|
/**
|
|
1317
|
-
*
|
|
1318
|
-
* otherwise false.
|
|
1319
|
-
* If false is returned for all elements, an IllegalStateError is thrown.
|
|
1180
|
+
* Object references for sourceA.
|
|
1320
1181
|
*/
|
|
1321
|
-
__publicField(this, "
|
|
1182
|
+
__publicField(this, "refsA", /* @__PURE__ */ new Set());
|
|
1322
1183
|
/**
|
|
1323
|
-
*
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
__publicField(this, "onEvict", null);
|
|
1328
|
-
__publicField(this, "_capacity", 0);
|
|
1329
|
-
this._capacity = initialCapacity;
|
|
1330
|
-
}
|
|
1331
|
-
get capacity() {
|
|
1332
|
-
return this._capacity;
|
|
1333
|
-
}
|
|
1334
|
-
set capacity(value) {
|
|
1335
|
-
this._capacity = value;
|
|
1336
|
-
while (this.cache.size > this.capacity) {
|
|
1337
|
-
this.evictLeastRecentlyUsed();
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
/**
|
|
1341
|
-
* @returns the number of elements in the Map.
|
|
1342
|
-
*/
|
|
1343
|
-
get size() {
|
|
1344
|
-
return this.cache.size;
|
|
1345
|
-
}
|
|
1346
|
-
/**
|
|
1347
|
-
* @returns boolean indicating whether an element with the specified key exists or not.
|
|
1348
|
-
*/
|
|
1349
|
-
has(key) {
|
|
1350
|
-
return this.cache.has(key);
|
|
1351
|
-
}
|
|
1352
|
-
/**
|
|
1353
|
-
* Returns the mapped value for the given key, and moves the element to the most recently
|
|
1354
|
-
* used position.
|
|
1355
|
-
*
|
|
1356
|
-
* @returns Returns the element associated with the given key, or undefined if no such
|
|
1357
|
-
* element exists.
|
|
1358
|
-
*/
|
|
1359
|
-
get(key) {
|
|
1360
|
-
const node = this.cache.get(key);
|
|
1361
|
-
if (!node) return void 0;
|
|
1362
|
-
this.list.pushNode(node);
|
|
1363
|
-
return node.value[1];
|
|
1364
|
-
}
|
|
1365
|
-
/**
|
|
1366
|
-
* Adds a new element with a specified key and value to the Map. If an element with the
|
|
1367
|
-
* same key already exists, the element will be updated and position moved to most recently
|
|
1368
|
-
* used.
|
|
1369
|
-
*/
|
|
1370
|
-
set(key, value) {
|
|
1371
|
-
if (this.has(key)) {
|
|
1372
|
-
const node = this.cache.get(key);
|
|
1373
|
-
node.value[1] = value;
|
|
1374
|
-
this.list.pushNode(node);
|
|
1375
|
-
} else {
|
|
1376
|
-
const node = this.list.push([key, value]);
|
|
1377
|
-
this.cache.set(key, node);
|
|
1378
|
-
if (this.cache.size > this.capacity) {
|
|
1379
|
-
this.evictLeastRecentlyUsed();
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
return this;
|
|
1383
|
-
}
|
|
1384
|
-
evictLeastRecentlyUsed() {
|
|
1385
|
-
var _a, _b, _c;
|
|
1386
|
-
let node = this.list.head;
|
|
1387
|
-
while (node) {
|
|
1388
|
-
const [key2, value2] = node.value;
|
|
1389
|
-
const allowed = (_b = (_a = this.onEvicting) == null ? void 0 : _a.call(null, value2, key2, this)) != null ? _b : true;
|
|
1390
|
-
if (allowed) break;
|
|
1391
|
-
node = node.next;
|
|
1392
|
-
}
|
|
1393
|
-
if (!node)
|
|
1394
|
-
throw new IllegalStateError(
|
|
1395
|
-
"onEvicting returned false for all elements"
|
|
1396
|
-
);
|
|
1397
|
-
const [key, value] = node.value;
|
|
1398
|
-
this.list.remove(node);
|
|
1399
|
-
this.cache.delete(node.value[0]);
|
|
1400
|
-
(_c = this.onEvict) == null ? void 0 : _c.call(null, value, key, this);
|
|
1401
|
-
}
|
|
1402
|
-
/**
|
|
1403
|
-
* Clears all elements from the cache.
|
|
1404
|
-
*/
|
|
1405
|
-
clear() {
|
|
1406
|
-
this.list.clear();
|
|
1407
|
-
this.cache.clear();
|
|
1408
|
-
}
|
|
1409
|
-
/**
|
|
1410
|
-
* @returns true if an element in the Map existed and has been removed, or false if the element does not exist.
|
|
1411
|
-
*/
|
|
1412
|
-
delete(key) {
|
|
1413
|
-
if (!this.has(key)) return false;
|
|
1414
|
-
const node = this.cache.get(key);
|
|
1415
|
-
this.cache.delete(key);
|
|
1416
|
-
this.list.remove(node);
|
|
1417
|
-
return true;
|
|
1418
|
-
}
|
|
1419
|
-
/**
|
|
1420
|
-
* Executes a provided function once per each key/value pair in the Map, in insertion order.
|
|
1421
|
-
*
|
|
1422
|
-
* @param callback A callback to invoke for every element in the cache.
|
|
1423
|
-
* @param thisArg Value to use as this when executing callback
|
|
1424
|
-
*/
|
|
1425
|
-
forEach(callback, thisArg) {
|
|
1426
|
-
return this.list.forEach((entry) => {
|
|
1427
|
-
callback.call(thisArg, entry[1], entry[0], this);
|
|
1428
|
-
});
|
|
1429
|
-
}
|
|
1430
|
-
/**
|
|
1431
|
-
* Returns an iterable of key, value pairs for every entry in the map.
|
|
1432
|
-
*/
|
|
1433
|
-
entries() {
|
|
1434
|
-
return this[Symbol.iterator]();
|
|
1184
|
+
* Object references for sourceB.
|
|
1185
|
+
*/
|
|
1186
|
+
__publicField(this, "refsB", /* @__PURE__ */ new Set());
|
|
1187
|
+
__publicField(this, "propStack", []);
|
|
1435
1188
|
}
|
|
1436
1189
|
/**
|
|
1437
|
-
*
|
|
1438
|
-
* most.
|
|
1190
|
+
* The property stack, joined by .
|
|
1439
1191
|
*/
|
|
1440
|
-
|
|
1441
|
-
return
|
|
1192
|
+
get currentPath() {
|
|
1193
|
+
return this.propStack.map((e) => e[2]).filter((e) => e != null).join(".");
|
|
1442
1194
|
}
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
values() {
|
|
1448
|
-
return mapIter(this.list, ([, value]) => value);
|
|
1195
|
+
push(sourceA, sourceB, prop) {
|
|
1196
|
+
this.propStack.push([sourceA, sourceB, prop]);
|
|
1197
|
+
this.addRef(this.refsA, sourceA);
|
|
1198
|
+
this.addRef(this.refsB, sourceB);
|
|
1449
1199
|
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1200
|
+
pop() {
|
|
1201
|
+
const last = this.propStack.pop();
|
|
1202
|
+
this.refsA.delete(last[0]);
|
|
1203
|
+
this.refsB.delete(last[1]);
|
|
1452
1204
|
}
|
|
1453
|
-
|
|
1454
|
-
|
|
1205
|
+
addRef(refSet, source) {
|
|
1206
|
+
if (typeof source !== "object") return;
|
|
1207
|
+
if (refSet.has(source)) {
|
|
1208
|
+
throw new IllegalArgumentError(
|
|
1209
|
+
substitute(locale2.cyclicRefError, { path: this.currentPath })
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1212
|
+
refSet.add(source);
|
|
1455
1213
|
}
|
|
1456
1214
|
};
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1215
|
+
function _mergeDeep(sourceA, sourceB, propStack, prop, options) {
|
|
1216
|
+
if (typeof sourceB !== "object" || sourceB === null) return sourceB;
|
|
1217
|
+
const merge = (sourceA2, sourceB2, prop2) => {
|
|
1218
|
+
return _mergeDeep(sourceA2, sourceB2, propStack, prop2, options);
|
|
1219
|
+
};
|
|
1220
|
+
for (const rule of options.rules) {
|
|
1221
|
+
if (rule.matches(sourceB)) {
|
|
1222
|
+
propStack.push(sourceA, sourceB, prop);
|
|
1223
|
+
const result = rule.merge(
|
|
1224
|
+
rule.matches(sourceA) ? sourceA : void 0,
|
|
1225
|
+
sourceB,
|
|
1226
|
+
merge
|
|
1227
|
+
);
|
|
1228
|
+
propStack.pop();
|
|
1229
|
+
return result;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
if (!options.allowReferenceCopy) {
|
|
1233
|
+
propStack.push(sourceA, sourceB, prop);
|
|
1234
|
+
throw new MergeReferenceError(propStack.currentPath, sourceB);
|
|
1235
|
+
}
|
|
1236
|
+
return sourceB;
|
|
1237
|
+
}
|
|
1238
|
+
var MergeReferenceError = class _MergeReferenceError extends ReportableError {
|
|
1239
|
+
constructor(propPath, source) {
|
|
1240
|
+
super(
|
|
1241
|
+
substitute(locale2.mergeReferenceError, {
|
|
1242
|
+
path: propPath,
|
|
1243
|
+
source
|
|
1244
|
+
})
|
|
1478
1245
|
);
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1246
|
+
Object.setPrototypeOf(this, _MergeReferenceError.prototype);
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
var cloneableMergeRule = {
|
|
1250
|
+
matches(object) {
|
|
1251
|
+
return isCloneable(object);
|
|
1252
|
+
},
|
|
1253
|
+
merge(_1, sourceB, _2) {
|
|
1254
|
+
return sourceB.clone();
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
var arrayMergeRule = {
|
|
1258
|
+
matches(object) {
|
|
1259
|
+
return Array.isArray(object);
|
|
1260
|
+
},
|
|
1261
|
+
merge(sourceA, sourceB, merge) {
|
|
1262
|
+
const out = [];
|
|
1263
|
+
if (sourceA) {
|
|
1264
|
+
for (const element of sourceA) {
|
|
1265
|
+
out.push(merge(void 0, element, out.length));
|
|
1486
1266
|
}
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1267
|
+
}
|
|
1268
|
+
for (const element of sourceB) {
|
|
1269
|
+
out.push(merge(void 0, element, out.length));
|
|
1270
|
+
}
|
|
1271
|
+
return out;
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
var plainObjectMergeRule = {
|
|
1275
|
+
matches(object) {
|
|
1276
|
+
return isPlainObject(object);
|
|
1277
|
+
},
|
|
1278
|
+
merge(sourceA, sourceB, merge) {
|
|
1279
|
+
const out = {};
|
|
1280
|
+
for (const key of union(ownKeys(sourceA), ownKeys(sourceB))) {
|
|
1281
|
+
if (sourceA && key in sourceB && key in sourceA) {
|
|
1282
|
+
out[key] = merge(sourceA[key], sourceB[key], key);
|
|
1283
|
+
} else if (sourceA && key in sourceA) {
|
|
1284
|
+
out[key] = merge(void 0, sourceA[key], key);
|
|
1285
|
+
} else {
|
|
1286
|
+
out[key] = merge(void 0, sourceB[key], key);
|
|
1498
1287
|
}
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1288
|
+
}
|
|
1289
|
+
return out;
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
var regexpMergeRule = {
|
|
1293
|
+
matches(object) {
|
|
1294
|
+
return object instanceof RegExp;
|
|
1295
|
+
},
|
|
1296
|
+
merge(_1, sourceB, _2) {
|
|
1297
|
+
return new RegExp(sourceB.source, sourceB.flags);
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
var dateMergeRule = {
|
|
1301
|
+
matches(object) {
|
|
1302
|
+
return object instanceof Date;
|
|
1303
|
+
},
|
|
1304
|
+
merge(_1, sourceB, _2) {
|
|
1305
|
+
return new Date(sourceB.getTime());
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
var mapMergeRule = {
|
|
1309
|
+
matches(object) {
|
|
1310
|
+
return object instanceof Map;
|
|
1311
|
+
},
|
|
1312
|
+
merge(sourceA, sourceB, merge) {
|
|
1313
|
+
var _a;
|
|
1314
|
+
const out = /* @__PURE__ */ new Map();
|
|
1315
|
+
for (const key of /* @__PURE__ */ new Set([
|
|
1316
|
+
...(_a = sourceA == null ? void 0 : sourceA.keys()) != null ? _a : [],
|
|
1317
|
+
...sourceB.keys()
|
|
1318
|
+
])) {
|
|
1319
|
+
if (sourceB.has(key) && (sourceA == null ? void 0 : sourceA.has(key))) {
|
|
1320
|
+
out.set(key, merge(sourceA.get(key), sourceB.get(key), key));
|
|
1321
|
+
} else if (sourceA == null ? void 0 : sourceA.has(key)) {
|
|
1322
|
+
out.set(key, merge(void 0, sourceA.get(key), key));
|
|
1323
|
+
} else {
|
|
1324
|
+
out.set(key, merge(void 0, sourceB.get(key), key));
|
|
1507
1325
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1326
|
+
}
|
|
1327
|
+
return out;
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
var setMergeRule = {
|
|
1331
|
+
matches(object) {
|
|
1332
|
+
return object instanceof Set;
|
|
1333
|
+
},
|
|
1334
|
+
merge(sourceA, sourceB, merge) {
|
|
1335
|
+
var _a;
|
|
1336
|
+
return new Set(
|
|
1337
|
+
[...(_a = sourceA == null ? void 0 : sourceA.values()) != null ? _a : [], ...sourceB.values()].map(
|
|
1338
|
+
(element, index) => {
|
|
1339
|
+
return merge(void 0, element, index);
|
|
1520
1340
|
}
|
|
1521
|
-
|
|
1341
|
+
)
|
|
1522
1342
|
);
|
|
1523
1343
|
}
|
|
1344
|
+
};
|
|
1345
|
+
var typedArrayMergeRule = {
|
|
1346
|
+
matches(object) {
|
|
1347
|
+
return isTypedArray(object);
|
|
1348
|
+
},
|
|
1349
|
+
merge(_1, sourceB, _2) {
|
|
1350
|
+
return cloneTypedArray(sourceB);
|
|
1351
|
+
}
|
|
1352
|
+
};
|
|
1353
|
+
var urlMergeRule = {
|
|
1354
|
+
matches(object) {
|
|
1355
|
+
return object instanceof URL;
|
|
1356
|
+
},
|
|
1357
|
+
merge(_1, sourceB, _2) {
|
|
1358
|
+
return new URL(sourceB.toString());
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
var defaultMergeOptions = {
|
|
1362
|
+
allowReferenceCopy: true,
|
|
1363
|
+
rules: [
|
|
1364
|
+
cloneableMergeRule,
|
|
1365
|
+
arrayMergeRule,
|
|
1366
|
+
plainObjectMergeRule,
|
|
1367
|
+
regexpMergeRule,
|
|
1368
|
+
dateMergeRule,
|
|
1369
|
+
mapMergeRule,
|
|
1370
|
+
setMergeRule,
|
|
1371
|
+
typedArrayMergeRule,
|
|
1372
|
+
urlMergeRule
|
|
1373
|
+
]
|
|
1374
|
+
};
|
|
1375
|
+
|
|
1376
|
+
// src/util/url/resolveUrl.ts
|
|
1377
|
+
var SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;
|
|
1378
|
+
function resolveUrl(relative, base) {
|
|
1379
|
+
if (SCHEME_RE.test(relative)) return relative;
|
|
1380
|
+
if (relative.startsWith("//")) {
|
|
1381
|
+
const schemeEnd2 = base.indexOf("://");
|
|
1382
|
+
return base.substring(0, schemeEnd2 + 1) + relative;
|
|
1383
|
+
}
|
|
1384
|
+
const schemeEnd = base.indexOf("://") + 3;
|
|
1385
|
+
const pathStart = base.indexOf("/", schemeEnd);
|
|
1386
|
+
const origin = pathStart === -1 ? base : base.substring(0, pathStart);
|
|
1387
|
+
if (relative.startsWith("/")) return origin + relative;
|
|
1388
|
+
if (relative === "") return base;
|
|
1389
|
+
const basePath = pathStart === -1 ? "/" : base.substring(pathStart);
|
|
1390
|
+
const lastSlash = basePath.lastIndexOf("/");
|
|
1391
|
+
const dir = basePath.substring(0, lastSlash + 1);
|
|
1392
|
+
return origin + resolveDots(dir + relative);
|
|
1524
1393
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1394
|
+
function resolveDots(path) {
|
|
1395
|
+
if (path.indexOf(".") === -1) return path;
|
|
1396
|
+
const parts = path.split("/");
|
|
1397
|
+
const out = [];
|
|
1398
|
+
for (let i = 0; i < parts.length; i++) {
|
|
1399
|
+
const p = parts[i];
|
|
1400
|
+
if (p === "..") {
|
|
1401
|
+
if (out.length > 1) out.pop();
|
|
1402
|
+
} else if (p !== ".") {
|
|
1403
|
+
out.push(p);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
return out.join("/");
|
|
1529
1407
|
}
|
|
1530
|
-
var defaultLocation = {
|
|
1531
|
-
origin: "",
|
|
1532
|
-
search: "",
|
|
1533
|
-
href: ""
|
|
1534
|
-
};
|
|
1535
1408
|
|
|
1536
|
-
//
|
|
1537
|
-
var
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
1
|
|
1545
|
-
);
|
|
1546
|
-
function getLocationSearch() {
|
|
1547
|
-
return getLocation().search;
|
|
1409
|
+
// test/browserTestUtil/benchmark/Benchmark.ts
|
|
1410
|
+
var now;
|
|
1411
|
+
if (typeof window !== "undefined" && typeof window.performance !== "undefined" && typeof window.performance.now !== "undefined") {
|
|
1412
|
+
now = () => window.performance.now();
|
|
1413
|
+
} else if (typeof self !== "undefined" && typeof self.performance !== "undefined" && typeof self.performance.now !== "undefined") {
|
|
1414
|
+
now = () => self.performance.now();
|
|
1415
|
+
} else {
|
|
1416
|
+
now = () => Date.now();
|
|
1548
1417
|
}
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
__publicField(this, "
|
|
1554
|
-
}
|
|
1555
|
-
/**
|
|
1556
|
-
* Returns the number of references currently in the registry.
|
|
1557
|
-
*/
|
|
1558
|
-
get size() {
|
|
1559
|
-
return this.registry.length;
|
|
1418
|
+
var BenchmarkRunResults = class {
|
|
1419
|
+
constructor(name) {
|
|
1420
|
+
__publicField(this, "name", name);
|
|
1421
|
+
__publicField(this, "cycleResults", []);
|
|
1422
|
+
__publicField(this, "_totalSamples", 0);
|
|
1560
1423
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
* @param initializer
|
|
1564
|
-
*/
|
|
1565
|
-
register(initializer) {
|
|
1566
|
-
this.registry.push(initializer);
|
|
1567
|
-
return initializer;
|
|
1424
|
+
get totalSamples() {
|
|
1425
|
+
return this._totalSamples;
|
|
1568
1426
|
}
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
return remove(this.registry, ref);
|
|
1427
|
+
get cycleResultsNoOutliers() {
|
|
1428
|
+
const sD = this.standardDeviation;
|
|
1429
|
+
const avg = average(this.cycleResults);
|
|
1430
|
+
return this.cycleResults.filter((e) => {
|
|
1431
|
+
const zScore = (avg - e) / sD;
|
|
1432
|
+
return Math.abs(zScore) < 3;
|
|
1433
|
+
});
|
|
1577
1434
|
}
|
|
1578
1435
|
/**
|
|
1579
|
-
*
|
|
1580
|
-
* This is typically only done within unit tests, but may be called if all players are
|
|
1581
|
-
* disposed and the consumer intends to teardown global state.
|
|
1436
|
+
* Returns the mean ops per second minus outliers of greater than 3 standard deviations.
|
|
1582
1437
|
*/
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
registryElement.reset();
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
};
|
|
1589
|
-
var _registry = null;
|
|
1590
|
-
function getGlobalRegistry() {
|
|
1591
|
-
if (!_registry) _registry = new GlobalRegistry();
|
|
1592
|
-
return _registry;
|
|
1593
|
-
}
|
|
1594
|
-
var globalRefDebug = false;
|
|
1595
|
-
var GlobalRefImpl = class {
|
|
1596
|
-
constructor(defaultInitializer) {
|
|
1597
|
-
this.defaultInitializer = defaultInitializer;
|
|
1598
|
-
__publicField(this, "_value");
|
|
1599
|
-
__publicField(this, "_initialized", false);
|
|
1600
|
-
__publicField(this, "constructing", false);
|
|
1601
|
-
__publicField(this, "initializer");
|
|
1602
|
-
__publicField(this, "lastInitStack", null);
|
|
1603
|
-
this.initializer = defaultInitializer;
|
|
1604
|
-
}
|
|
1605
|
-
get initialized() {
|
|
1606
|
-
return this._initialized;
|
|
1607
|
-
}
|
|
1608
|
-
get value() {
|
|
1609
|
-
this.initialize();
|
|
1610
|
-
return this._value;
|
|
1438
|
+
get meanOpsPerSec() {
|
|
1439
|
+
return average(this.cycleResultsNoOutliers);
|
|
1611
1440
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
if (!this._initialized) return;
|
|
1615
|
-
this.assertNotConstructing();
|
|
1616
|
-
this._initialized = false;
|
|
1617
|
-
this.lastInitStack = null;
|
|
1618
|
-
if (isDisposable(this._value)) {
|
|
1619
|
-
this._value.dispose();
|
|
1620
|
-
}
|
|
1621
|
-
this._value = void 0;
|
|
1441
|
+
get standardDeviation() {
|
|
1442
|
+
return standardDeviation(this.cycleResults);
|
|
1622
1443
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
this.assertNotConstructing();
|
|
1626
|
-
this.constructing = true;
|
|
1627
|
-
try {
|
|
1628
|
-
this._value = this.initializer();
|
|
1629
|
-
} catch (error) {
|
|
1630
|
-
this.constructing = false;
|
|
1631
|
-
throw error;
|
|
1632
|
-
}
|
|
1633
|
-
this.constructing = false;
|
|
1634
|
-
this._initialized = true;
|
|
1635
|
-
if (globalRefDebug) {
|
|
1636
|
-
this.lastInitStack = new Error("globalRef initialized").stack;
|
|
1637
|
-
}
|
|
1444
|
+
get variance() {
|
|
1445
|
+
return this.standardDeviation / this.meanOpsPerSec;
|
|
1638
1446
|
}
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
}
|
|
1651
|
-
);
|
|
1447
|
+
/**
|
|
1448
|
+
* Returns the mean ops / s ± variance % as a string.
|
|
1449
|
+
*/
|
|
1450
|
+
get meanOpsStr() {
|
|
1451
|
+
const mean = this.meanOpsPerSec.toLocaleString(void 0, {
|
|
1452
|
+
maximumSignificantDigits: 4
|
|
1453
|
+
});
|
|
1454
|
+
const variance = this.variance.toLocaleString(void 0, {
|
|
1455
|
+
style: "percent"
|
|
1456
|
+
});
|
|
1457
|
+
return `${mean} \xB1${variance}`;
|
|
1652
1458
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
}
|
|
1459
|
+
add(cycle) {
|
|
1460
|
+
const opsPerSecond = cycle.ops / cycle.duration;
|
|
1461
|
+
let index = this.cycleResults.findIndex((value) => opsPerSecond < value);
|
|
1462
|
+
if (index < 0) index = this.cycleResults.length;
|
|
1463
|
+
this.cycleResults.splice(index, 0, opsPerSecond);
|
|
1464
|
+
this._totalSamples += cycle.ops;
|
|
1660
1465
|
}
|
|
1661
|
-
|
|
1662
|
-
if (this.
|
|
1663
|
-
|
|
1466
|
+
toString() {
|
|
1467
|
+
if (!this.cycleResults.length) return "No results";
|
|
1468
|
+
return `${this.name}: ${this.meanOpsStr} ops/sec`;
|
|
1664
1469
|
}
|
|
1665
1470
|
};
|
|
1666
|
-
var
|
|
1667
|
-
constructor(
|
|
1668
|
-
this
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
this
|
|
1471
|
+
var RunResultsComparison = class {
|
|
1472
|
+
constructor(name, results) {
|
|
1473
|
+
__publicField(this, "name", name);
|
|
1474
|
+
/**
|
|
1475
|
+
* Sorted by median ops/s from slowest to fastest.
|
|
1476
|
+
*/
|
|
1477
|
+
__publicField(this, "results");
|
|
1478
|
+
this.results = results.sort((a, b) => {
|
|
1479
|
+
return a.meanOpsPerSec - b.meanOpsPerSec;
|
|
1480
|
+
});
|
|
1673
1481
|
}
|
|
1674
|
-
|
|
1675
|
-
|
|
1482
|
+
logToTable() {
|
|
1483
|
+
const r = this.results.map((run) => {
|
|
1484
|
+
const variance = run.variance.toLocaleString(void 0, {
|
|
1485
|
+
style: "percent"
|
|
1486
|
+
});
|
|
1487
|
+
const mean = run.meanOpsPerSec.toLocaleString(void 0, {
|
|
1488
|
+
maximumSignificantDigits: 4
|
|
1489
|
+
});
|
|
1490
|
+
return {
|
|
1491
|
+
Name: run.name,
|
|
1492
|
+
Mean: `${mean} \xB1${variance}`,
|
|
1493
|
+
Samples: run.totalSamples,
|
|
1494
|
+
Compare: this.runComparisonToString(run)
|
|
1495
|
+
};
|
|
1496
|
+
});
|
|
1497
|
+
const table = r.reduce((acc, _a) => {
|
|
1498
|
+
var _b = _a, { Name } = _b, x = __objRest(_b, ["Name"]);
|
|
1499
|
+
acc[Name] = x;
|
|
1500
|
+
return acc;
|
|
1501
|
+
}, {});
|
|
1502
|
+
console.log("\n" + this.name);
|
|
1503
|
+
console.table(table);
|
|
1676
1504
|
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1505
|
+
runComparisonToString(run) {
|
|
1506
|
+
var _a, _b;
|
|
1507
|
+
const baseline = (_b = (_a = this.results[0]) == null ? void 0 : _a.meanOpsPerSec) != null ? _b : 0;
|
|
1508
|
+
const fasterPercent = run.meanOpsPerSec / baseline - 1;
|
|
1509
|
+
return fasterPercent < 0.01 ? "-" : fasterPercent.toLocaleString(void 0, {
|
|
1510
|
+
style: "percent"
|
|
1511
|
+
}) + " faster";
|
|
1679
1512
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1513
|
+
};
|
|
1514
|
+
function compareResults(name, ...results) {
|
|
1515
|
+
return new RunResultsComparison(name, results);
|
|
1516
|
+
}
|
|
1517
|
+
var defaultBenchmarkOptions = {
|
|
1518
|
+
warmupTime: 0.5,
|
|
1519
|
+
maxCycleDuration: 0.5,
|
|
1520
|
+
cycles: 9
|
|
1521
|
+
};
|
|
1522
|
+
var _Benchmark = class _Benchmark {
|
|
1523
|
+
/**
|
|
1524
|
+
* Constructs a new Benchmark.
|
|
1525
|
+
*
|
|
1526
|
+
* @param name The name of the benchmark, to be used when logging.
|
|
1527
|
+
* @param executor The method to execute and measure. If this method returns a promise, the
|
|
1528
|
+
* promise will be awaited. The executor should either always return a promise, or never.
|
|
1529
|
+
* @param options Optional configuration for the benchmark.
|
|
1530
|
+
*/
|
|
1531
|
+
constructor(name, executor, options) {
|
|
1532
|
+
__publicField(this, "name", name);
|
|
1533
|
+
__publicField(this, "executor", executor);
|
|
1534
|
+
__publicField(this, "options");
|
|
1535
|
+
this.options = __spreadValues(__spreadValues({}, defaultBenchmarkOptions), options);
|
|
1683
1536
|
}
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1537
|
+
async run() {
|
|
1538
|
+
const opts = this.options;
|
|
1539
|
+
await _Benchmark.semaphore;
|
|
1540
|
+
const warmupTimeMs = opts.warmupTime * 1e3;
|
|
1541
|
+
const cycleStart = now();
|
|
1542
|
+
let isAsync = false;
|
|
1543
|
+
do {
|
|
1544
|
+
const result = this.executor();
|
|
1545
|
+
isAsync = isAsync || result && typeof result.then === "function";
|
|
1546
|
+
if (isAsync) await result;
|
|
1547
|
+
} while (now() - cycleStart < warmupTimeMs);
|
|
1548
|
+
const resultsPromise = (async () => {
|
|
1549
|
+
const results = new BenchmarkRunResults(this.name);
|
|
1550
|
+
for (let i = 0; i < opts.cycles; i++) {
|
|
1551
|
+
const cycleResults = await this.runCycle(isAsync);
|
|
1552
|
+
results.add(cycleResults);
|
|
1553
|
+
await nextFrame();
|
|
1554
|
+
}
|
|
1555
|
+
return results;
|
|
1556
|
+
})();
|
|
1557
|
+
_Benchmark.semaphore = resultsPromise;
|
|
1558
|
+
return await resultsPromise;
|
|
1688
1559
|
}
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1560
|
+
/**
|
|
1561
|
+
* Runs one cycle. A cycle will repeat the executor approximately `options.maxCycleDuration`
|
|
1562
|
+
* seconds.
|
|
1563
|
+
*
|
|
1564
|
+
* @param isAsync
|
|
1565
|
+
* @return Returns the duration (in seconds) and number of operations the cycle repeated.
|
|
1566
|
+
*/
|
|
1567
|
+
async runCycle(isAsync) {
|
|
1568
|
+
const cycleMs = this.options.maxCycleDuration * 1e3;
|
|
1569
|
+
let ops = 0;
|
|
1570
|
+
const cycleStart = now();
|
|
1571
|
+
do {
|
|
1572
|
+
const result = this.executor();
|
|
1573
|
+
if (isAsync) await result;
|
|
1574
|
+
ops++;
|
|
1575
|
+
} while (now() - cycleStart < cycleMs);
|
|
1576
|
+
const duration = (now() - cycleStart) / 1e3;
|
|
1577
|
+
return {
|
|
1578
|
+
duration,
|
|
1579
|
+
ops
|
|
1692
1580
|
};
|
|
1693
|
-
this.initializer = overriddenInitializer;
|
|
1694
|
-
this.setInitializer(overriddenInitializer);
|
|
1695
|
-
return new _GlobalRefOverride(
|
|
1696
|
-
this,
|
|
1697
|
-
overriddenInitializer,
|
|
1698
|
-
this.setInitializer
|
|
1699
|
-
);
|
|
1700
1581
|
}
|
|
1701
1582
|
};
|
|
1702
|
-
|
|
1703
|
-
|
|
1583
|
+
__publicField(_Benchmark, "semaphore", nextFrame());
|
|
1584
|
+
var Benchmark = _Benchmark;
|
|
1585
|
+
function benchmark(name, executor, options) {
|
|
1586
|
+
const benchmark2 = new Benchmark(name, executor, options);
|
|
1587
|
+
return benchmark2.run().then((results) => {
|
|
1588
|
+
console.log(results.toString());
|
|
1589
|
+
return results;
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
function nextFrame() {
|
|
1593
|
+
return new Promise((resolve) => {
|
|
1594
|
+
setTimeout(resolve);
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
function standardDeviation(values) {
|
|
1598
|
+
const avg = average(values);
|
|
1599
|
+
const squareDiffs = values.map((value) => {
|
|
1600
|
+
const diff = value - avg;
|
|
1601
|
+
return diff * diff;
|
|
1602
|
+
});
|
|
1603
|
+
const avgSquareDiff = average(squareDiffs);
|
|
1604
|
+
return Math.sqrt(avgSquareDiff);
|
|
1605
|
+
}
|
|
1606
|
+
function average(values) {
|
|
1607
|
+
const sum = values.reduce((acc, value) => acc + value, 0);
|
|
1608
|
+
return sum / values.length;
|
|
1704
1609
|
}
|
|
1705
1610
|
|
|
1706
|
-
//
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1611
|
+
// test/browserTestUtil/env/jasmineEnv.ts
|
|
1612
|
+
var nextTestTimeoutOverridden = false;
|
|
1613
|
+
function setTestTimeout(timeout) {
|
|
1614
|
+
let originalTimeout = null;
|
|
1615
|
+
beforeEach(() => {
|
|
1616
|
+
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
1617
|
+
if (!nextTestTimeoutOverridden)
|
|
1618
|
+
jasmine.DEFAULT_TIMEOUT_INTERVAL = timeout * 1e3;
|
|
1619
|
+
});
|
|
1620
|
+
afterEach(() => {
|
|
1621
|
+
if (originalTimeout) jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
|
1622
|
+
if (nextTestTimeoutOverridden) nextTestTimeoutOverridden = false;
|
|
1623
|
+
});
|
|
1712
1624
|
}
|
|
1713
1625
|
|
|
1714
|
-
//
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1626
|
+
// test/browserTestUtil/expect/expectNothing.ts
|
|
1627
|
+
function expectNothing() {
|
|
1628
|
+
expect(true).toBeTruthy();
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
// test/browserTestUtil/mock/createSpyFactory.ts
|
|
1632
|
+
var createSpy = jasmine.createSpy;
|
|
1633
|
+
function createSpy2(key) {
|
|
1634
|
+
return createSpy(String(key));
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
// test/browserTestUtil/mock/dom/lib.dom.ts
|
|
1638
|
+
var MockAbortSignal = class {
|
|
1639
|
+
constructor() {
|
|
1640
|
+
__publicField(this, "aborted", false);
|
|
1641
|
+
__publicField(this, "onabort", null);
|
|
1642
|
+
__publicField(this, "reason");
|
|
1643
|
+
__publicField(this, "throwIfAborted", createSpy2("throwIfAborted"));
|
|
1644
|
+
__publicField(this, "addEventListener", createSpy2("addEventListener"));
|
|
1645
|
+
__publicField(this, "removeEventListener", createSpy2(
|
|
1646
|
+
"removeEventListener"
|
|
1647
|
+
));
|
|
1648
|
+
__publicField(this, "dispatchEvent", createSpy2("dispatchEvent"));
|
|
1730
1649
|
}
|
|
1731
1650
|
};
|
|
1732
|
-
var
|
|
1733
|
-
()
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1651
|
+
var MockMediaSource = class {
|
|
1652
|
+
constructor() {
|
|
1653
|
+
__publicField(this, "activeSourceBuffers");
|
|
1654
|
+
__publicField(this, "duration", 0);
|
|
1655
|
+
__publicField(this, "onsourceclose", null);
|
|
1656
|
+
__publicField(this, "onsourceended", null);
|
|
1657
|
+
__publicField(this, "onsourceopen", null);
|
|
1658
|
+
__publicField(this, "readyState", "closed");
|
|
1659
|
+
__publicField(this, "sourceBuffers");
|
|
1660
|
+
__publicField(this, "addSourceBuffer", createSpy2("addSourceBuffer"));
|
|
1661
|
+
__publicField(this, "clearLiveSeekableRange", createSpy2(
|
|
1662
|
+
"clearLiveSeekableRange"
|
|
1663
|
+
));
|
|
1664
|
+
__publicField(this, "endOfStream", createSpy2("endOfStream"));
|
|
1665
|
+
__publicField(this, "removeSourceBuffer", createSpy2("removeSourceBuffer"));
|
|
1666
|
+
__publicField(this, "setLiveSeekableRange", createSpy2(
|
|
1667
|
+
"setLiveSeekableRange"
|
|
1668
|
+
));
|
|
1669
|
+
__publicField(this, "addEventListener", createSpy2("addEventListener"));
|
|
1670
|
+
__publicField(this, "removeEventListener", createSpy2(
|
|
1671
|
+
"removeEventListener"
|
|
1672
|
+
));
|
|
1673
|
+
__publicField(this, "dispatchEvent", createSpy2("dispatchEvent"));
|
|
1674
|
+
}
|
|
1749
1675
|
};
|
|
1750
|
-
function parseLogLevel(str) {
|
|
1751
|
-
var _a;
|
|
1752
|
-
return (_a = strToLogLevel[str.toLowerCase()]) != null ? _a : null;
|
|
1753
|
-
}
|
|
1754
1676
|
|
|
1755
|
-
// test/
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
const
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
const segment = "seg_001.m4s";
|
|
1799
|
-
const resolveUrlResults = await benchmark(`resolveUrl ${name}`, () => {
|
|
1800
|
-
let resolved = manifest;
|
|
1801
|
-
for (const scope of scopes) {
|
|
1802
|
-
resolved = resolveUrl(scope, resolved);
|
|
1803
|
-
}
|
|
1804
|
-
resolveUrl(segment, resolved);
|
|
1805
|
-
});
|
|
1806
|
-
const newUrlResults = await benchmark(`new URL ${name}`, () => {
|
|
1807
|
-
let resolved = new URL(manifest);
|
|
1808
|
-
for (const scope of scopes) {
|
|
1809
|
-
resolved = new URL(scope, resolved);
|
|
1677
|
+
// test/browserTestUtil/mock/dom/globals.ts
|
|
1678
|
+
var MockMediaSourceGlobal = class extends MockMediaSource {
|
|
1679
|
+
};
|
|
1680
|
+
__publicField(MockMediaSourceGlobal, "canConstructInDedicatedWorker", false);
|
|
1681
|
+
__publicField(MockMediaSourceGlobal, "isTypeSupported", createSpy2(
|
|
1682
|
+
"isTypeSupported"
|
|
1683
|
+
));
|
|
1684
|
+
var MockAbortSignalGlobal = class extends MockAbortSignal {
|
|
1685
|
+
};
|
|
1686
|
+
__publicField(MockAbortSignalGlobal, "abort", createSpy2("abort"));
|
|
1687
|
+
__publicField(MockAbortSignalGlobal, "any", createSpy2("any"));
|
|
1688
|
+
__publicField(MockAbortSignalGlobal, "timeout", createSpy2("timeout"));
|
|
1689
|
+
|
|
1690
|
+
// test/benchmark/setup.ts
|
|
1691
|
+
function setupBenchmark() {
|
|
1692
|
+
setTestTimeout(180);
|
|
1693
|
+
afterEach(expectNothing);
|
|
1694
|
+
}
|
|
1695
|
+
var comparisons = [];
|
|
1696
|
+
function addComparison(comparison) {
|
|
1697
|
+
comparisons.push(comparison);
|
|
1698
|
+
}
|
|
1699
|
+
function addBenchmarks(name, ...results) {
|
|
1700
|
+
const comparison = compareResults(name, ...results);
|
|
1701
|
+
comparison.logToTable();
|
|
1702
|
+
comparisons.push(comparison);
|
|
1703
|
+
}
|
|
1704
|
+
if (typeof document !== "undefined") {
|
|
1705
|
+
jasmine.getEnv().addReporter({
|
|
1706
|
+
jasmineDone: () => {
|
|
1707
|
+
var _a;
|
|
1708
|
+
console.log("Tests complete");
|
|
1709
|
+
const jasmineContainer = document.getElementsByClassName(
|
|
1710
|
+
"jasmine_html-reporter"
|
|
1711
|
+
)[0];
|
|
1712
|
+
(_a = jasmineContainer.parentElement) == null ? void 0 : _a.removeChild(jasmineContainer);
|
|
1713
|
+
const container = createEl("div", document.body);
|
|
1714
|
+
container.id = "benchmarkResults";
|
|
1715
|
+
const sortedComparisons = [...comparisons].sort(
|
|
1716
|
+
(a, b) => a.name > b.name ? 1 : -1
|
|
1717
|
+
);
|
|
1718
|
+
for (const comparison of sortedComparisons) {
|
|
1719
|
+
toTableHtml(comparison, container);
|
|
1810
1720
|
}
|
|
1811
|
-
|
|
1812
|
-
});
|
|
1813
|
-
addBenchmarks(name, resolveUrlResults, newUrlResults);
|
|
1721
|
+
}
|
|
1814
1722
|
});
|
|
1815
|
-
}
|
|
1723
|
+
}
|
|
1724
|
+
function toTableHtml(comparison, parent) {
|
|
1725
|
+
const container = createEl("div", parent);
|
|
1726
|
+
container.className = "benchmarkComparison";
|
|
1727
|
+
const title = createEl("h2", container);
|
|
1728
|
+
title.innerText = comparison.name;
|
|
1729
|
+
const table = createEl("table", container);
|
|
1730
|
+
const head = createEl("thead", table);
|
|
1731
|
+
const headRow = createEl("tr", head);
|
|
1732
|
+
const name = createEl("th", headRow);
|
|
1733
|
+
name.innerText = "Name";
|
|
1734
|
+
const median = createEl("th", headRow);
|
|
1735
|
+
median.innerText = "Mean ops/s";
|
|
1736
|
+
const samples = createEl("th", headRow);
|
|
1737
|
+
samples.innerText = "Samples";
|
|
1738
|
+
const compare = createEl("th", headRow);
|
|
1739
|
+
compare.innerText = "% Comparison";
|
|
1740
|
+
const body = createEl("tbody", table);
|
|
1741
|
+
comparison.results.forEach((result) => {
|
|
1742
|
+
const row = createEl("tr", body);
|
|
1743
|
+
createEl("th", row).innerText = result.name;
|
|
1744
|
+
createEl("td", row).innerText = result.meanOpsStr;
|
|
1745
|
+
createEl("td", row).innerText = result.totalSamples.toLocaleString();
|
|
1746
|
+
createEl("td", row).innerText = comparison.runComparisonToString(result);
|
|
1747
|
+
});
|
|
1748
|
+
return container;
|
|
1749
|
+
}
|
|
1750
|
+
function createEl(tagName, parent, options) {
|
|
1751
|
+
const element = document.createElement(tagName, options);
|
|
1752
|
+
if (parent) parent.appendChild(element);
|
|
1753
|
+
return element;
|
|
1754
|
+
}
|
|
1816
1755
|
|
|
1817
|
-
// test/benchmark/
|
|
1818
|
-
describe("
|
|
1756
|
+
// test/benchmark/logging/Logging.bench.ts
|
|
1757
|
+
describe("Logging", () => {
|
|
1819
1758
|
setupBenchmark();
|
|
1820
|
-
it("
|
|
1821
|
-
const
|
|
1822
|
-
|
|
1759
|
+
it("logDebug", async () => {
|
|
1760
|
+
const target = {
|
|
1761
|
+
logPrefix: "path"
|
|
1762
|
+
};
|
|
1763
|
+
const results = await benchmark(`logDebug`, () => {
|
|
1764
|
+
logDebug(target, {
|
|
1823
1765
|
requestInfo: {
|
|
1824
1766
|
fetchId: "lgn9lrwaid8o3utd5r",
|
|
1825
1767
|
init: {
|
|
@@ -1835,7 +1777,7 @@ ${this.lastInitStack}` : "";
|
|
|
1835
1777
|
input: "https://example.com/bar/",
|
|
1836
1778
|
maxRetries: 1,
|
|
1837
1779
|
timestamp: /* @__PURE__ */ new Date("2023-04-19T05:40:17.914Z"),
|
|
1838
|
-
|
|
1780
|
+
fetchOptions: {
|
|
1839
1781
|
serviceId: null,
|
|
1840
1782
|
readErrorBody: 1
|
|
1841
1783
|
}
|
|
@@ -1847,51 +1789,7 @@ ${this.lastInitStack}` : "";
|
|
|
1847
1789
|
target: "[object FetchProviderImpl]"
|
|
1848
1790
|
});
|
|
1849
1791
|
});
|
|
1850
|
-
addBenchmarks("
|
|
1851
|
-
});
|
|
1852
|
-
});
|
|
1853
|
-
|
|
1854
|
-
// test/benchmark/util/object/mergeDeep.bench.ts
|
|
1855
|
-
describe("mergeDeep", () => {
|
|
1856
|
-
setupBenchmark();
|
|
1857
|
-
it("object merge", async () => {
|
|
1858
|
-
const a = {
|
|
1859
|
-
b: {
|
|
1860
|
-
c: 3,
|
|
1861
|
-
d: 4,
|
|
1862
|
-
e: "test"
|
|
1863
|
-
},
|
|
1864
|
-
f: {
|
|
1865
|
-
g: 5,
|
|
1866
|
-
h: true,
|
|
1867
|
-
i: false
|
|
1868
|
-
},
|
|
1869
|
-
j: {
|
|
1870
|
-
k: {
|
|
1871
|
-
m: 5
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
};
|
|
1875
|
-
const b = {
|
|
1876
|
-
b: {
|
|
1877
|
-
d: 4,
|
|
1878
|
-
f2: "test2"
|
|
1879
|
-
},
|
|
1880
|
-
f: {
|
|
1881
|
-
g: 5,
|
|
1882
|
-
h: true,
|
|
1883
|
-
i: false
|
|
1884
|
-
},
|
|
1885
|
-
j: {
|
|
1886
|
-
k: {
|
|
1887
|
-
m: 5
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
};
|
|
1891
|
-
const mergeResultsDeep = await benchmark(`mergeDeep`, () => {
|
|
1892
|
-
mergeDeep([a, b]);
|
|
1893
|
-
});
|
|
1894
|
-
addBenchmarks("merge deep", mergeResultsDeep);
|
|
1792
|
+
addBenchmarks("logDebug", results);
|
|
1895
1793
|
});
|
|
1896
1794
|
});
|
|
1897
1795
|
|
|
@@ -1983,15 +1881,56 @@ ${this.lastInitStack}` : "";
|
|
|
1983
1881
|
});
|
|
1984
1882
|
});
|
|
1985
1883
|
|
|
1986
|
-
// test/benchmark/
|
|
1987
|
-
describe("
|
|
1884
|
+
// test/benchmark/util/object/mergeDeep.bench.ts
|
|
1885
|
+
describe("mergeDeep", () => {
|
|
1988
1886
|
setupBenchmark();
|
|
1989
|
-
it("
|
|
1990
|
-
const
|
|
1991
|
-
|
|
1887
|
+
it("object merge", async () => {
|
|
1888
|
+
const a = {
|
|
1889
|
+
b: {
|
|
1890
|
+
c: 3,
|
|
1891
|
+
d: 4,
|
|
1892
|
+
e: "test"
|
|
1893
|
+
},
|
|
1894
|
+
f: {
|
|
1895
|
+
g: 5,
|
|
1896
|
+
h: true,
|
|
1897
|
+
i: false
|
|
1898
|
+
},
|
|
1899
|
+
j: {
|
|
1900
|
+
k: {
|
|
1901
|
+
m: 5
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1992
1904
|
};
|
|
1993
|
-
const
|
|
1994
|
-
|
|
1905
|
+
const b = {
|
|
1906
|
+
b: {
|
|
1907
|
+
d: 4,
|
|
1908
|
+
f2: "test2"
|
|
1909
|
+
},
|
|
1910
|
+
f: {
|
|
1911
|
+
g: 5,
|
|
1912
|
+
h: true,
|
|
1913
|
+
i: false
|
|
1914
|
+
},
|
|
1915
|
+
j: {
|
|
1916
|
+
k: {
|
|
1917
|
+
m: 5
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
};
|
|
1921
|
+
const mergeResultsDeep = await benchmark(`mergeDeep`, () => {
|
|
1922
|
+
mergeDeep([a, b]);
|
|
1923
|
+
});
|
|
1924
|
+
addBenchmarks("merge deep", mergeResultsDeep);
|
|
1925
|
+
});
|
|
1926
|
+
});
|
|
1927
|
+
|
|
1928
|
+
// test/benchmark/util/serialization/toJson.bench.ts
|
|
1929
|
+
describe("json", () => {
|
|
1930
|
+
setupBenchmark();
|
|
1931
|
+
it("toJson", async () => {
|
|
1932
|
+
const results = await benchmark(`toJson`, () => {
|
|
1933
|
+
toJson({
|
|
1995
1934
|
requestInfo: {
|
|
1996
1935
|
fetchId: "lgn9lrwaid8o3utd5r",
|
|
1997
1936
|
init: {
|
|
@@ -2007,7 +1946,7 @@ ${this.lastInitStack}` : "";
|
|
|
2007
1946
|
input: "https://example.com/bar/",
|
|
2008
1947
|
maxRetries: 1,
|
|
2009
1948
|
timestamp: /* @__PURE__ */ new Date("2023-04-19T05:40:17.914Z"),
|
|
2010
|
-
|
|
1949
|
+
requestOptions: {
|
|
2011
1950
|
serviceId: null,
|
|
2012
1951
|
readErrorBody: 1
|
|
2013
1952
|
}
|
|
@@ -2019,7 +1958,69 @@ ${this.lastInitStack}` : "";
|
|
|
2019
1958
|
target: "[object FetchProviderImpl]"
|
|
2020
1959
|
});
|
|
2021
1960
|
});
|
|
2022
|
-
addBenchmarks("
|
|
1961
|
+
addBenchmarks("toJson", results);
|
|
1962
|
+
});
|
|
1963
|
+
});
|
|
1964
|
+
|
|
1965
|
+
// test/benchmark/util/url/resolveUrl.bench.ts
|
|
1966
|
+
describe("resolveUrl", () => {
|
|
1967
|
+
setupBenchmark();
|
|
1968
|
+
it("relative path", async () => {
|
|
1969
|
+
const name = "relative path";
|
|
1970
|
+
const base = "https://cdn.example.com/content/audio/";
|
|
1971
|
+
const relative = "segment_001.mp4";
|
|
1972
|
+
const resolveUrlResults = await benchmark(`resolveUrl ${name}`, () => {
|
|
1973
|
+
const _o = resolveUrl(relative, base);
|
|
1974
|
+
});
|
|
1975
|
+
const newUrlResults = await benchmark(`new URL ${name}`, () => {
|
|
1976
|
+
const _o = new URL(relative, base).href;
|
|
1977
|
+
});
|
|
1978
|
+
addBenchmarks(name, resolveUrlResults, newUrlResults);
|
|
1979
|
+
});
|
|
1980
|
+
it("absolute URI", async () => {
|
|
1981
|
+
const name = "absolute URI";
|
|
1982
|
+
const base = "https://cdn.example.com/content/audio/";
|
|
1983
|
+
const absolute = "https://other.example.com/segment.mp4";
|
|
1984
|
+
const resolveUrlResults = await benchmark(`resolveUrl ${name}`, () => {
|
|
1985
|
+
const _o = resolveUrl(absolute, base);
|
|
1986
|
+
});
|
|
1987
|
+
const newUrlResults = await benchmark(`new URL ${name}`, () => {
|
|
1988
|
+
const _o = new URL(absolute, base).href;
|
|
1989
|
+
});
|
|
1990
|
+
addBenchmarks(name, resolveUrlResults, newUrlResults);
|
|
1991
|
+
});
|
|
1992
|
+
it("dot segments", async () => {
|
|
1993
|
+
const name = "dot segments";
|
|
1994
|
+
const base = "https://cdn.example.com/a/b/c/manifest.mpd";
|
|
1995
|
+
const relative = "../../media/segment.mp4";
|
|
1996
|
+
const resolveUrlResults = await benchmark(`resolveUrl ${name}`, () => {
|
|
1997
|
+
const _o = resolveUrl(relative, base);
|
|
1998
|
+
});
|
|
1999
|
+
const newUrlResults = await benchmark(`new URL ${name}`, () => {
|
|
2000
|
+
const _o = new URL(relative, base).href;
|
|
2001
|
+
});
|
|
2002
|
+
addBenchmarks(name, resolveUrlResults, newUrlResults);
|
|
2003
|
+
});
|
|
2004
|
+
it("chained resolution (DASH BaseURL walk)", async () => {
|
|
2005
|
+
const name = "chained resolution";
|
|
2006
|
+
const manifest = "https://cdn.example.com/manifest.mpd";
|
|
2007
|
+
const scopes = ["content/", "audio/", "128k/"];
|
|
2008
|
+
const segment = "seg_001.m4s";
|
|
2009
|
+
const resolveUrlResults = await benchmark(`resolveUrl ${name}`, () => {
|
|
2010
|
+
let resolved = manifest;
|
|
2011
|
+
for (const scope of scopes) {
|
|
2012
|
+
resolved = resolveUrl(scope, resolved);
|
|
2013
|
+
}
|
|
2014
|
+
resolveUrl(segment, resolved);
|
|
2015
|
+
});
|
|
2016
|
+
const newUrlResults = await benchmark(`new URL ${name}`, () => {
|
|
2017
|
+
let resolved = new URL(manifest);
|
|
2018
|
+
for (const scope of scopes) {
|
|
2019
|
+
resolved = new URL(scope, resolved);
|
|
2020
|
+
}
|
|
2021
|
+
const _o = new URL(segment, resolved).href;
|
|
2022
|
+
});
|
|
2023
|
+
addBenchmarks(name, resolveUrlResults, newUrlResults);
|
|
2023
2024
|
});
|
|
2024
2025
|
});
|
|
2025
2026
|
})();
|