devtools-tracing 1.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/generate.ts +643 -0
- package/index.ts +16 -0
- package/lib/front_end/core/common/App.ts +7 -0
- package/lib/front_end/core/common/AppProvider.ts +32 -0
- package/lib/front_end/core/common/Base64.ts +47 -0
- package/lib/front_end/core/common/CharacterIdMap.ts +30 -0
- package/lib/front_end/core/common/Color.ts +2506 -0
- package/lib/front_end/core/common/ColorConverter.ts +402 -0
- package/lib/front_end/core/common/ColorUtils.ts +252 -0
- package/lib/front_end/core/common/Console.ts +114 -0
- package/lib/front_end/core/common/Debouncer.ts +15 -0
- package/lib/front_end/core/common/EventTarget.ts +52 -0
- package/lib/front_end/core/common/Gzip.ts +74 -0
- package/lib/front_end/core/common/JavaScriptMetaData.ts +29 -0
- package/lib/front_end/core/common/Lazy.ts +31 -0
- package/lib/front_end/core/common/Linkifier.ts +55 -0
- package/lib/front_end/core/common/MapWithDefault.ts +26 -0
- package/lib/front_end/core/common/Mutex.ts +55 -0
- package/lib/front_end/core/common/Object.ts +145 -0
- package/lib/front_end/core/common/ParsedURL.ts +554 -0
- package/lib/front_end/core/common/Progress.ts +180 -0
- package/lib/front_end/core/common/QueryParamHandler.ts +7 -0
- package/lib/front_end/core/common/ResolverBase.ts +85 -0
- package/lib/front_end/core/common/ResourceType.ts +588 -0
- package/lib/front_end/core/common/ReturnToPanel.ts +17 -0
- package/lib/front_end/core/common/Revealer.ts +192 -0
- package/lib/front_end/core/common/Runnable.ts +41 -0
- package/lib/front_end/core/common/SegmentedRange.ts +87 -0
- package/lib/front_end/core/common/SettingRegistration.ts +339 -0
- package/lib/front_end/core/common/Settings.ts +1497 -0
- package/lib/front_end/core/common/SimpleHistoryManager.ts +124 -0
- package/lib/front_end/core/common/StringOutputStream.ts +26 -0
- package/lib/front_end/core/common/TextDictionary.ts +48 -0
- package/lib/front_end/core/common/Throttler.ts +99 -0
- package/lib/front_end/core/common/Trie.ts +152 -0
- package/lib/front_end/core/common/Worker.ts +60 -0
- package/lib/front_end/core/common/common.ts +81 -0
- package/lib/front_end/core/host/AidaClient.ts +733 -0
- package/lib/front_end/core/host/GdpClient.ts +316 -0
- package/lib/front_end/core/host/InspectorFrontendHost.ts +648 -0
- package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +551 -0
- package/lib/front_end/core/host/Platform.ts +76 -0
- package/lib/front_end/core/host/ResourceLoader.ts +282 -0
- package/lib/front_end/core/host/UserMetrics.ts +1230 -0
- package/lib/front_end/core/host/host.ts +23 -0
- package/lib/front_end/core/i18n/ByteUtilities.ts +82 -0
- package/lib/front_end/core/i18n/DevToolsLocale.ts +87 -0
- package/lib/front_end/core/i18n/NumberFormatter.ts +82 -0
- package/lib/front_end/core/i18n/i18n.ts +17 -0
- package/lib/front_end/core/i18n/i18nImpl.ts +204 -0
- package/lib/front_end/core/i18n/i18nTypes.ts +10 -0
- package/lib/front_end/core/i18n/locales.js +14 -0
- package/lib/front_end/core/i18n/time-utilities.ts +174 -0
- package/lib/front_end/core/platform/ArrayUtilities.ts +271 -0
- package/lib/front_end/core/platform/Brand.ts +23 -0
- package/lib/front_end/core/platform/Constructor.ts +10 -0
- package/lib/front_end/core/platform/DOMUtilities.ts +138 -0
- package/lib/front_end/core/platform/DateUtilities.ts +15 -0
- package/lib/front_end/core/platform/DevToolsPath.ts +53 -0
- package/lib/front_end/core/platform/KeyboardUtilities.ts +38 -0
- package/lib/front_end/core/platform/MapUtilities.ts +95 -0
- package/lib/front_end/core/platform/MimeType.ts +175 -0
- package/lib/front_end/core/platform/NumberUtilities.ts +80 -0
- package/lib/front_end/core/platform/StringUtilities.ts +588 -0
- package/lib/front_end/core/platform/Timing.ts +17 -0
- package/lib/front_end/core/platform/TypedArrayUtilities.ts +189 -0
- package/lib/front_end/core/platform/TypescriptUtilities.ts +86 -0
- package/lib/front_end/core/platform/UIString.ts +39 -0
- package/lib/front_end/core/platform/UserVisibleError.ts +28 -0
- package/lib/front_end/core/platform/platform.ts +45 -0
- package/lib/front_end/core/protocol_client/ConnectionTransport.ts +26 -0
- package/lib/front_end/core/protocol_client/InspectorBackend.ts +1050 -0
- package/lib/front_end/core/protocol_client/NodeURL.ts +42 -0
- package/lib/front_end/core/protocol_client/protocol_client.ts +13 -0
- package/lib/front_end/core/root/Runtime.ts +609 -0
- package/lib/front_end/core/root/root.ts +6 -0
- package/lib/front_end/core/sdk/AccessibilityModel.ts +353 -0
- package/lib/front_end/core/sdk/AnimationModel.ts +1041 -0
- package/lib/front_end/core/sdk/AutofillModel.ts +184 -0
- package/lib/front_end/core/sdk/CPUProfilerModel.ts +148 -0
- package/lib/front_end/core/sdk/CPUThrottlingManager.ts +282 -0
- package/lib/front_end/core/sdk/CSSContainerQuery.ts +139 -0
- package/lib/front_end/core/sdk/CSSFontFace.ts +40 -0
- package/lib/front_end/core/sdk/CSSLayer.ts +30 -0
- package/lib/front_end/core/sdk/CSSMatchedStyles.ts +1646 -0
- package/lib/front_end/core/sdk/CSSMedia.ts +121 -0
- package/lib/front_end/core/sdk/CSSMetadata.ts +1647 -0
- package/lib/front_end/core/sdk/CSSModel.ts +1128 -0
- package/lib/front_end/core/sdk/CSSProperty.ts +384 -0
- package/lib/front_end/core/sdk/CSSPropertyParser.ts +681 -0
- package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +1395 -0
- package/lib/front_end/core/sdk/CSSQuery.ts +72 -0
- package/lib/front_end/core/sdk/CSSRule.ts +465 -0
- package/lib/front_end/core/sdk/CSSScope.ts +30 -0
- package/lib/front_end/core/sdk/CSSStartingStyle.ts +29 -0
- package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +313 -0
- package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +196 -0
- package/lib/front_end/core/sdk/CSSSupports.ts +33 -0
- package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +64 -0
- package/lib/front_end/core/sdk/ChildTargetManager.ts +314 -0
- package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +62 -0
- package/lib/front_end/core/sdk/Connections.ts +293 -0
- package/lib/front_end/core/sdk/ConsoleModel.ts +808 -0
- package/lib/front_end/core/sdk/ConsoleModelTypes.ts +15 -0
- package/lib/front_end/core/sdk/Cookie.ts +319 -0
- package/lib/front_end/core/sdk/CookieModel.ts +239 -0
- package/lib/front_end/core/sdk/CookieParser.ts +185 -0
- package/lib/front_end/core/sdk/DOMDebuggerModel.ts +787 -0
- package/lib/front_end/core/sdk/DOMModel.ts +1961 -0
- package/lib/front_end/core/sdk/DebuggerModel.ts +1605 -0
- package/lib/front_end/core/sdk/EmulationModel.ts +648 -0
- package/lib/front_end/core/sdk/EnhancedTracesParser.ts +515 -0
- package/lib/front_end/core/sdk/EventBreakpointsModel.ts +183 -0
- package/lib/front_end/core/sdk/FrameAssociated.ts +11 -0
- package/lib/front_end/core/sdk/FrameManager.ts +259 -0
- package/lib/front_end/core/sdk/HeapProfilerModel.ts +225 -0
- package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +77 -0
- package/lib/front_end/core/sdk/IOModel.ts +91 -0
- package/lib/front_end/core/sdk/IsolateManager.ts +257 -0
- package/lib/front_end/core/sdk/IssuesModel.ts +70 -0
- package/lib/front_end/core/sdk/LayerTreeBase.ts +169 -0
- package/lib/front_end/core/sdk/LogModel.ts +56 -0
- package/lib/front_end/core/sdk/NetworkManager.ts +2823 -0
- package/lib/front_end/core/sdk/NetworkRequest.ts +2253 -0
- package/lib/front_end/core/sdk/OverlayColorGenerator.ts +52 -0
- package/lib/front_end/core/sdk/OverlayModel.ts +1011 -0
- package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +522 -0
- package/lib/front_end/core/sdk/PageLoad.ts +35 -0
- package/lib/front_end/core/sdk/PageResourceLoader.ts +435 -0
- package/lib/front_end/core/sdk/PaintProfiler.ts +110 -0
- package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +84 -0
- package/lib/front_end/core/sdk/PreloadingModel.ts +863 -0
- package/lib/front_end/core/sdk/RehydratingConnection.ts +386 -0
- package/lib/front_end/core/sdk/RehydratingObject.ts +66 -0
- package/lib/front_end/core/sdk/RemoteObject.ts +1160 -0
- package/lib/front_end/core/sdk/Resource.ts +232 -0
- package/lib/front_end/core/sdk/ResourceTreeModel.ts +1160 -0
- package/lib/front_end/core/sdk/RuntimeModel.ts +732 -0
- package/lib/front_end/core/sdk/SDKModel.ts +65 -0
- package/lib/front_end/core/sdk/ScopeTreeCache.ts +45 -0
- package/lib/front_end/core/sdk/ScreenCaptureModel.ts +255 -0
- package/lib/front_end/core/sdk/Script.ts +534 -0
- package/lib/front_end/core/sdk/SecurityOriginManager.ts +76 -0
- package/lib/front_end/core/sdk/ServerSentEvents.ts +80 -0
- package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +122 -0
- package/lib/front_end/core/sdk/ServerTiming.ts +260 -0
- package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +377 -0
- package/lib/front_end/core/sdk/ServiceWorkerManager.ts +605 -0
- package/lib/front_end/core/sdk/SourceMap.ts +867 -0
- package/lib/front_end/core/sdk/SourceMapCache.ts +54 -0
- package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +156 -0
- package/lib/front_end/core/sdk/SourceMapManager.ts +239 -0
- package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +189 -0
- package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +508 -0
- package/lib/front_end/core/sdk/StorageBucketsModel.ts +204 -0
- package/lib/front_end/core/sdk/StorageKeyManager.ts +98 -0
- package/lib/front_end/core/sdk/Target.ts +332 -0
- package/lib/front_end/core/sdk/TargetManager.ts +453 -0
- package/lib/front_end/core/sdk/TraceObject.ts +61 -0
- package/lib/front_end/core/sdk/WebAuthnModel.ts +104 -0
- package/lib/front_end/core/sdk/sdk.ts +174 -0
- package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +59 -0
- package/lib/front_end/generated/InspectorBackendCommands.js +1617 -0
- package/lib/front_end/generated/SupportedCSSProperties.js +7512 -0
- package/lib/front_end/generated/protocol-proxy-api.d.ts +5022 -0
- package/lib/front_end/generated/protocol.ts +22014 -0
- package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +571 -0
- package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +103 -0
- package/lib/front_end/models/cpu_profile/cpu_profile.ts +11 -0
- package/lib/front_end/models/formatter/FormatterWorkerPool.ts +219 -0
- package/lib/front_end/models/formatter/ScriptFormatter.ts +112 -0
- package/lib/front_end/models/formatter/formatter.ts +8 -0
- package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +37 -0
- package/lib/front_end/models/text_utils/ContentData.ts +199 -0
- package/lib/front_end/models/text_utils/ContentProvider.ts +68 -0
- package/lib/front_end/models/text_utils/StaticContentProvider.ts +49 -0
- package/lib/front_end/models/text_utils/StreamingContentData.ts +108 -0
- package/lib/front_end/models/text_utils/Text.ts +90 -0
- package/lib/front_end/models/text_utils/TextCursor.ts +44 -0
- package/lib/front_end/models/text_utils/TextRange.ts +266 -0
- package/lib/front_end/models/text_utils/TextUtils.ts +401 -0
- package/lib/front_end/models/text_utils/WasmDisassembly.ts +87 -0
- package/lib/front_end/models/text_utils/text_utils.ts +27 -0
- package/lib/front_end/models/trace/EntityMapper.ts +141 -0
- package/lib/front_end/models/trace/EventsSerializer.ts +101 -0
- package/lib/front_end/models/trace/LanternComputationData.ts +438 -0
- package/lib/front_end/models/trace/ModelImpl.ts +236 -0
- package/lib/front_end/models/trace/Name.ts +136 -0
- package/lib/front_end/models/trace/Processor.ts +652 -0
- package/lib/front_end/models/trace/Styles.ts +1138 -0
- package/lib/front_end/models/trace/extras/FilmStrip.ts +78 -0
- package/lib/front_end/models/trace/extras/MainThreadActivity.ts +86 -0
- package/lib/front_end/models/trace/extras/ScriptDuplication.ts +236 -0
- package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +203 -0
- package/lib/front_end/models/trace/extras/ThirdParties.ts +164 -0
- package/lib/front_end/models/trace/extras/TraceFilter.ts +62 -0
- package/lib/front_end/models/trace/extras/TraceTree.ts +701 -0
- package/lib/front_end/models/trace/extras/extras.ts +11 -0
- package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +128 -0
- package/lib/front_end/models/trace/handlers/AnimationHandler.ts +36 -0
- package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +239 -0
- package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +183 -0
- package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +31 -0
- package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +306 -0
- package/lib/front_end/models/trace/handlers/FlowsHandler.ts +175 -0
- package/lib/front_end/models/trace/handlers/FramesHandler.ts +571 -0
- package/lib/front_end/models/trace/handlers/GPUHandler.ts +50 -0
- package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +183 -0
- package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +193 -0
- package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +168 -0
- package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +109 -0
- package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +35 -0
- package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +123 -0
- package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +573 -0
- package/lib/front_end/models/trace/handlers/MemoryHandler.ts +31 -0
- package/lib/front_end/models/trace/handlers/MetaHandler.ts +525 -0
- package/lib/front_end/models/trace/handlers/ModelHandlers.ts +34 -0
- package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +672 -0
- package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +52 -0
- package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +460 -0
- package/lib/front_end/models/trace/handlers/RendererHandler.ts +428 -0
- package/lib/front_end/models/trace/handlers/SamplesHandler.ts +271 -0
- package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +122 -0
- package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +336 -0
- package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +110 -0
- package/lib/front_end/models/trace/handlers/Threads.ts +139 -0
- package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +400 -0
- package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +233 -0
- package/lib/front_end/models/trace/handlers/WarningsHandler.ts +162 -0
- package/lib/front_end/models/trace/handlers/WorkersHandler.ts +45 -0
- package/lib/front_end/models/trace/handlers/handlers.ts +8 -0
- package/lib/front_end/models/trace/handlers/helpers.ts +196 -0
- package/lib/front_end/models/trace/handlers/types.ts +75 -0
- package/lib/front_end/models/trace/helpers/Extensions.ts +54 -0
- package/lib/front_end/models/trace/helpers/Network.ts +129 -0
- package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +544 -0
- package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +87 -0
- package/lib/front_end/models/trace/helpers/Timing.ts +248 -0
- package/lib/front_end/models/trace/helpers/Trace.ts +928 -0
- package/lib/front_end/models/trace/helpers/TreeHelpers.ts +320 -0
- package/lib/front_end/models/trace/helpers/helpers.ts +11 -0
- package/lib/front_end/models/trace/insights/CLSCulprits.ts +668 -0
- package/lib/front_end/models/trace/insights/Cache.ts +269 -0
- package/lib/front_end/models/trace/insights/Common.ts +453 -0
- package/lib/front_end/models/trace/insights/DOMSize.ts +223 -0
- package/lib/front_end/models/trace/insights/DocumentLatency.ts +319 -0
- package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +126 -0
- package/lib/front_end/models/trace/insights/FontDisplay.ts +119 -0
- package/lib/front_end/models/trace/insights/ForcedReflow.ts +220 -0
- package/lib/front_end/models/trace/insights/INPBreakdown.ts +171 -0
- package/lib/front_end/models/trace/insights/ImageDelivery.ts +348 -0
- package/lib/front_end/models/trace/insights/LCPBreakdown.ts +268 -0
- package/lib/front_end/models/trace/insights/LCPDiscovery.ts +237 -0
- package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +138 -0
- package/lib/front_end/models/trace/insights/Models.ts +22 -0
- package/lib/front_end/models/trace/insights/ModernHTTP.ts +257 -0
- package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +726 -0
- package/lib/front_end/models/trace/insights/RenderBlocking.ts +257 -0
- package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +175 -0
- package/lib/front_end/models/trace/insights/Statistics.ts +101 -0
- package/lib/front_end/models/trace/insights/ThirdParties.ts +130 -0
- package/lib/front_end/models/trace/insights/Viewport.ts +138 -0
- package/lib/front_end/models/trace/insights/insights.ts +10 -0
- package/lib/front_end/models/trace/insights/types.ts +157 -0
- package/lib/front_end/models/trace/lantern/core/LanternError.ts +7 -0
- package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +619 -0
- package/lib/front_end/models/trace/lantern/core/core.ts +6 -0
- package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +345 -0
- package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +80 -0
- package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +101 -0
- package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +636 -0
- package/lib/front_end/models/trace/lantern/graph/graph.ts +8 -0
- package/lib/front_end/models/trace/lantern/lantern.ts +17 -0
- package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +187 -0
- package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +88 -0
- package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +92 -0
- package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +72 -0
- package/lib/front_end/models/trace/lantern/metrics/Metric.ts +126 -0
- package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +126 -0
- package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +82 -0
- package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +112 -0
- package/lib/front_end/models/trace/lantern/metrics/metrics.ts +12 -0
- package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +150 -0
- package/lib/front_end/models/trace/lantern/simulation/Constants.ts +46 -0
- package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +61 -0
- package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +196 -0
- package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +556 -0
- package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +192 -0
- package/lib/front_end/models/trace/lantern/simulation/simulation.ts +10 -0
- package/lib/front_end/models/trace/lantern/types/Lantern.ts +220 -0
- package/lib/front_end/models/trace/lantern/types/types.ts +5 -0
- package/lib/front_end/models/trace/trace.ts +33 -0
- package/lib/front_end/models/trace/types/Configuration.ts +110 -0
- package/lib/front_end/models/trace/types/Extensions.ts +136 -0
- package/lib/front_end/models/trace/types/File.ts +281 -0
- package/lib/front_end/models/trace/types/Overlays.ts +138 -0
- package/lib/front_end/models/trace/types/Timing.ts +30 -0
- package/lib/front_end/models/trace/types/TraceEvents.ts +3277 -0
- package/lib/front_end/models/trace/types/types.ts +10 -0
- package/lib/front_end/third_party/i18n/LICENSE +202 -0
- package/lib/front_end/third_party/i18n/README.chromium +15 -0
- package/lib/front_end/third_party/i18n/i18n-impl.ts +61 -0
- package/lib/front_end/third_party/i18n/i18n.ts +11 -0
- package/lib/front_end/third_party/i18n/localized-string-set.ts +129 -0
- package/lib/front_end/third_party/intl-messageformat/LICENSE +33 -0
- package/lib/front_end/third_party/intl-messageformat/README.chromium +24 -0
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +16 -0
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +33 -0
- package/lib/front_end/third_party/intl-messageformat/package/README.md +3 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.js +13 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +5 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +1710 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +1815 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +10 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +229 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +28 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +48 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +179 -0
- package/lib/front_end/third_party/intl-messageformat/package/package.json +42 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.js +230 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +28 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.js +51 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +182 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +79 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +15 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +153 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +139 -0
- package/lib/front_end/third_party/legacy-javascript/LICENSE +202 -0
- package/lib/front_end/third_party/legacy-javascript/README.chromium +13 -0
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +8 -0
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +3 -0
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +18 -0
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +943 -0
- package/lib/front_end/third_party/legacy-javascript/package.json +8 -0
- package/lib/front_end/third_party/legacy-javascript/rebuild.sh +9 -0
- package/lib/front_end/third_party/third-party-web/LICENSE +20 -0
- package/lib/front_end/third_party/third-party-web/README.chromium +13 -0
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +2 -0
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +149 -0
- package/lib/front_end/third_party/third-party-web/package/LICENSE +20 -0
- package/lib/front_end/third_party/third-party-web/package/README.md +929 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/facades.md +46 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +1006 -0
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +139 -0
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +44 -0
- package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +27 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +34 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +246 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +36 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +9 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +5 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +151 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +14 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/package.json +46 -0
- package/lib/front_end/third_party/third-party-web/package.json +8 -0
- package/lib/front_end/third_party/third-party-web/rebuild.sh +13 -0
- package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +8 -0
- package/lib/front_end/third_party/third-party-web/third-party-web.ts +3 -0
- package/package.json +24 -0
- package/patches/chrome-devtools-frontend+1.0.1533544.patch +187 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Copyright 2024 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import * as Common from '../../core/common/common.js';
|
|
6
|
+
import * as Platform from '../../core/platform/platform.js';
|
|
7
|
+
|
|
8
|
+
import {ContentData, type ContentDataOrError} from './ContentData.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Usage of this class is mostly intended for content that is never "complete".
|
|
12
|
+
* E.g. streaming XHR/fetch requests.
|
|
13
|
+
*
|
|
14
|
+
* Due to the streaming nature this class only supports base64-encoded binary data.
|
|
15
|
+
* Decoding to text only happens on-demand by clients. This ensures that at most we have
|
|
16
|
+
* incomplete unicode at the end and not in-between chunks.
|
|
17
|
+
*/
|
|
18
|
+
export class StreamingContentData extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
19
|
+
readonly mimeType: string;
|
|
20
|
+
readonly #charset?: string;
|
|
21
|
+
|
|
22
|
+
readonly #disallowStreaming: boolean;
|
|
23
|
+
|
|
24
|
+
#chunks: string[] = [];
|
|
25
|
+
#contentData?: ContentData;
|
|
26
|
+
|
|
27
|
+
private constructor(mimeType: string, charset?: string, initialContent?: ContentData) {
|
|
28
|
+
super();
|
|
29
|
+
this.mimeType = mimeType;
|
|
30
|
+
this.#charset = charset;
|
|
31
|
+
this.#disallowStreaming = Boolean(initialContent && !initialContent.createdFromBase64);
|
|
32
|
+
this.#contentData = initialContent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new StreamingContentData with the given MIME type/charset.
|
|
37
|
+
*/
|
|
38
|
+
static create(mimeType: string, charset?: string): StreamingContentData {
|
|
39
|
+
return new StreamingContentData(mimeType, charset);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new StringContentData from an existing ContentData instance.
|
|
44
|
+
*
|
|
45
|
+
* Calling `addChunk` is on the resulting `StreamingContentData` is illegal if
|
|
46
|
+
* `content` was not created from base64 data. The reason is that JavaScript TextEncoder
|
|
47
|
+
* only supports UTF-8. We can't convert text with arbitrary encoding back to base64 for concatenation.
|
|
48
|
+
*/
|
|
49
|
+
static from(content: ContentData): StreamingContentData {
|
|
50
|
+
return new StreamingContentData(content.mimeType, content.charset, content);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** @returns true, if this `ContentData` was constructed from text content or the mime type indicates text that can be decoded */
|
|
54
|
+
get isTextContent(): boolean {
|
|
55
|
+
if (this.#contentData) {
|
|
56
|
+
return this.#contentData.isTextContent;
|
|
57
|
+
}
|
|
58
|
+
return Platform.MimeType.isTextType(this.mimeType);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** @param chunk base64 encoded data */
|
|
62
|
+
addChunk(chunk: string): void {
|
|
63
|
+
if (this.#disallowStreaming) {
|
|
64
|
+
throw new Error('Cannot add base64 data to a text-only ContentData.');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this.#chunks.push(chunk);
|
|
68
|
+
this.dispatchEventToListeners(Events.CHUNK_ADDED, {content: this, chunk});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @returns An immutable ContentData with all the bytes received so far */
|
|
72
|
+
content(): ContentData {
|
|
73
|
+
if (this.#contentData && this.#chunks.length === 0) {
|
|
74
|
+
return this.#contentData;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const initialBase64 = this.#contentData?.base64 ?? '';
|
|
78
|
+
const base64Content =
|
|
79
|
+
this.#chunks.reduce((acc, chunk) => Platform.StringUtilities.concatBase64(acc, chunk), initialBase64);
|
|
80
|
+
this.#contentData = new ContentData(base64Content, /* isBase64=*/ true, this.mimeType, this.#charset);
|
|
81
|
+
this.#chunks = [];
|
|
82
|
+
return this.#contentData;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type StreamingContentDataOrError = StreamingContentData|{error: string};
|
|
87
|
+
|
|
88
|
+
export const isError = function(contentDataOrError: StreamingContentDataOrError): contentDataOrError is {
|
|
89
|
+
error:
|
|
90
|
+
string,
|
|
91
|
+
} {
|
|
92
|
+
return 'error' in contentDataOrError;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const asContentDataOrError = function(contentDataOrError: StreamingContentDataOrError): ContentDataOrError {
|
|
96
|
+
if (isError(contentDataOrError)) {
|
|
97
|
+
return contentDataOrError;
|
|
98
|
+
}
|
|
99
|
+
return contentDataOrError.content();
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const enum Events {
|
|
103
|
+
CHUNK_ADDED = 'ChunkAdded',
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface EventTypes {
|
|
107
|
+
[Events.CHUNK_ADDED]: {content: StreamingContentData, chunk: string};
|
|
108
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Copyright 2016 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import * as Platform from '../../core/platform/platform.js';
|
|
6
|
+
|
|
7
|
+
import {TextCursor} from './TextCursor.js';
|
|
8
|
+
import {SourceRange, TextRange} from './TextRange.js';
|
|
9
|
+
|
|
10
|
+
export class Text {
|
|
11
|
+
readonly #value: string;
|
|
12
|
+
#lineEndings?: number[];
|
|
13
|
+
|
|
14
|
+
constructor(value: string) {
|
|
15
|
+
this.#value = value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
lineEndings(): number[] {
|
|
19
|
+
if (!this.#lineEndings) {
|
|
20
|
+
this.#lineEndings = Platform.StringUtilities.findLineEndingIndexes(this.#value);
|
|
21
|
+
}
|
|
22
|
+
return this.#lineEndings;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
value(): string {
|
|
26
|
+
return this.#value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
lineCount(): number {
|
|
30
|
+
const lineEndings = this.lineEndings();
|
|
31
|
+
return lineEndings.length;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
offsetFromPosition(lineNumber: number, columnNumber: number): number {
|
|
35
|
+
return (lineNumber ? this.lineEndings()[lineNumber - 1] + 1 : 0) + columnNumber;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
positionFromOffset(offset: number): Position {
|
|
39
|
+
const lineEndings = this.lineEndings();
|
|
40
|
+
const lineNumber =
|
|
41
|
+
Platform.ArrayUtilities.lowerBound(lineEndings, offset, Platform.ArrayUtilities.DEFAULT_COMPARATOR);
|
|
42
|
+
return {lineNumber, columnNumber: offset - (lineNumber && (lineEndings[lineNumber - 1] + 1))};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
lineAt(lineNumber: number): string {
|
|
46
|
+
const lineEndings = this.lineEndings();
|
|
47
|
+
const lineStart = lineNumber > 0 ? lineEndings[lineNumber - 1] + 1 : 0;
|
|
48
|
+
const lineEnd = lineEndings[lineNumber];
|
|
49
|
+
let lineContent = this.#value.substring(lineStart, lineEnd);
|
|
50
|
+
if (lineContent.length > 0 && lineContent.charAt(lineContent.length - 1) === '\r') {
|
|
51
|
+
lineContent = lineContent.substring(0, lineContent.length - 1);
|
|
52
|
+
}
|
|
53
|
+
return lineContent;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
toSourceRange(range: TextRange): SourceRange {
|
|
57
|
+
const start = this.offsetFromPosition(range.startLine, range.startColumn);
|
|
58
|
+
const end = this.offsetFromPosition(range.endLine, range.endColumn);
|
|
59
|
+
return new SourceRange(start, end - start);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
toTextRange(sourceRange: SourceRange): TextRange {
|
|
63
|
+
const cursor = new TextCursor(this.lineEndings());
|
|
64
|
+
const result = TextRange.createFromLocation(0, 0);
|
|
65
|
+
|
|
66
|
+
cursor.resetTo(sourceRange.offset);
|
|
67
|
+
result.startLine = cursor.lineNumber();
|
|
68
|
+
result.startColumn = cursor.columnNumber();
|
|
69
|
+
|
|
70
|
+
cursor.advance(sourceRange.offset + sourceRange.length);
|
|
71
|
+
result.endLine = cursor.lineNumber();
|
|
72
|
+
result.endColumn = cursor.columnNumber();
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
replaceRange(range: TextRange, replacement: string): string {
|
|
77
|
+
const sourceRange = this.toSourceRange(range);
|
|
78
|
+
return this.#value.substring(0, sourceRange.offset) + replacement +
|
|
79
|
+
this.#value.substring(sourceRange.offset + sourceRange.length);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
extract(range: TextRange): string {
|
|
83
|
+
const sourceRange = this.toSourceRange(range);
|
|
84
|
+
return this.#value.substr(sourceRange.offset, sourceRange.length);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export interface Position {
|
|
88
|
+
lineNumber: number;
|
|
89
|
+
columnNumber: number;
|
|
90
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright 2020 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import * as Platform from '../../core/platform/platform.js';
|
|
6
|
+
|
|
7
|
+
export class TextCursor {
|
|
8
|
+
readonly #lineEndings: number[];
|
|
9
|
+
|
|
10
|
+
#offset = 0;
|
|
11
|
+
#lineNumber = 0;
|
|
12
|
+
#columnNumber = 0;
|
|
13
|
+
|
|
14
|
+
constructor(lineEndings: number[]) {
|
|
15
|
+
this.#lineEndings = lineEndings;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
advance(offset: number): void {
|
|
19
|
+
this.#offset = offset;
|
|
20
|
+
while (this.#lineNumber < this.#lineEndings.length && this.#lineEndings[this.#lineNumber] < this.#offset) {
|
|
21
|
+
++this.#lineNumber;
|
|
22
|
+
}
|
|
23
|
+
this.#columnNumber = this.#lineNumber ? this.#offset - this.#lineEndings[this.#lineNumber - 1] - 1 : this.#offset;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
offset(): number {
|
|
27
|
+
return this.#offset;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
resetTo(offset: number): void {
|
|
31
|
+
this.#offset = offset;
|
|
32
|
+
this.#lineNumber =
|
|
33
|
+
Platform.ArrayUtilities.lowerBound(this.#lineEndings, offset, Platform.ArrayUtilities.DEFAULT_COMPARATOR);
|
|
34
|
+
this.#columnNumber = this.#lineNumber ? this.#offset - this.#lineEndings[this.#lineNumber - 1] - 1 : this.#offset;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
lineNumber(): number {
|
|
38
|
+
return this.#lineNumber;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
columnNumber(): number {
|
|
42
|
+
return this.#columnNumber;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
// Copyright 2013 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import * as Platform from '../../core/platform/platform.js';
|
|
6
|
+
|
|
7
|
+
const MAX_SAFE_INT32 = 2 ** 31 - 1;
|
|
8
|
+
|
|
9
|
+
export interface SerializedTextRange {
|
|
10
|
+
startLine: number;
|
|
11
|
+
startColumn: number;
|
|
12
|
+
endLine: number;
|
|
13
|
+
endColumn: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class TextRange {
|
|
17
|
+
constructor(public startLine: number, public startColumn: number, public endLine: number, public endColumn: number) {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static createFromLocation(line: number, column: number): TextRange {
|
|
21
|
+
return new TextRange(line, column, line, column);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static createUnboundedFromLocation(line: number, column: number): TextRange {
|
|
25
|
+
return new TextRange(line, column, MAX_SAFE_INT32, MAX_SAFE_INT32);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static fromObject(serializedTextRange: SerializedTextRange): TextRange {
|
|
29
|
+
return new TextRange(
|
|
30
|
+
serializedTextRange.startLine, serializedTextRange.startColumn, serializedTextRange.endLine,
|
|
31
|
+
serializedTextRange.endColumn);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static comparator(range1: TextRange, range2: TextRange): number {
|
|
35
|
+
return range1.compareTo(range2);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static fromEdit(oldRange: TextRange, newText: string): TextRange {
|
|
39
|
+
let endLine: number = oldRange.startLine;
|
|
40
|
+
let endColumn: number = oldRange.startColumn + newText.length;
|
|
41
|
+
|
|
42
|
+
const lineEndings = Platform.StringUtilities.findLineEndingIndexes(newText);
|
|
43
|
+
if (lineEndings.length > 1) {
|
|
44
|
+
endLine = oldRange.startLine + lineEndings.length - 1;
|
|
45
|
+
const len = lineEndings.length;
|
|
46
|
+
endColumn = lineEndings[len - 1] - lineEndings[len - 2] - 1;
|
|
47
|
+
}
|
|
48
|
+
return new TextRange(oldRange.startLine, oldRange.startColumn, endLine, endColumn);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
isEmpty(): boolean {
|
|
52
|
+
return this.startLine === this.endLine && this.startColumn === this.endColumn;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
immediatelyPrecedes(range?: TextRange): boolean {
|
|
56
|
+
if (!range) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return this.endLine === range.startLine && this.endColumn === range.startColumn;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
immediatelyFollows(range?: TextRange): boolean {
|
|
63
|
+
if (!range) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return range.immediatelyPrecedes(this);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
follows(range: TextRange): boolean {
|
|
70
|
+
return (range.endLine === this.startLine && range.endColumn <= this.startColumn) || range.endLine < this.startLine;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
get linesCount(): number {
|
|
74
|
+
return this.endLine - this.startLine;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
collapseToEnd(): TextRange {
|
|
78
|
+
return new TextRange(this.endLine, this.endColumn, this.endLine, this.endColumn);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
collapseToStart(): TextRange {
|
|
82
|
+
return new TextRange(this.startLine, this.startColumn, this.startLine, this.startColumn);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
normalize(): TextRange {
|
|
86
|
+
if (this.startLine > this.endLine || (this.startLine === this.endLine && this.startColumn > this.endColumn)) {
|
|
87
|
+
return new TextRange(this.endLine, this.endColumn, this.startLine, this.startColumn);
|
|
88
|
+
}
|
|
89
|
+
return this.clone();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
clone(): TextRange {
|
|
93
|
+
return new TextRange(this.startLine, this.startColumn, this.endLine, this.endColumn);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
serializeToObject(): {
|
|
97
|
+
startLine: number,
|
|
98
|
+
startColumn: number,
|
|
99
|
+
endLine: number,
|
|
100
|
+
endColumn: number,
|
|
101
|
+
} {
|
|
102
|
+
return {
|
|
103
|
+
startLine: this.startLine,
|
|
104
|
+
startColumn: this.startColumn,
|
|
105
|
+
endLine: this.endLine,
|
|
106
|
+
endColumn: this.endColumn,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
compareTo(other: TextRange): number {
|
|
111
|
+
if (this.startLine > other.startLine) {
|
|
112
|
+
return 1;
|
|
113
|
+
}
|
|
114
|
+
if (this.startLine < other.startLine) {
|
|
115
|
+
return -1;
|
|
116
|
+
}
|
|
117
|
+
if (this.startColumn > other.startColumn) {
|
|
118
|
+
return 1;
|
|
119
|
+
}
|
|
120
|
+
if (this.startColumn < other.startColumn) {
|
|
121
|
+
return -1;
|
|
122
|
+
}
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
compareToPosition(lineNumber: number, columnNumber: number): number {
|
|
127
|
+
if (lineNumber < this.startLine || (lineNumber === this.startLine && columnNumber < this.startColumn)) {
|
|
128
|
+
return -1;
|
|
129
|
+
}
|
|
130
|
+
if (lineNumber > this.endLine || (lineNumber === this.endLine && columnNumber > this.endColumn)) {
|
|
131
|
+
return 1;
|
|
132
|
+
}
|
|
133
|
+
return 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
equal(other: TextRange): boolean {
|
|
137
|
+
return this.startLine === other.startLine && this.endLine === other.endLine &&
|
|
138
|
+
this.startColumn === other.startColumn && this.endColumn === other.endColumn;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
relativeTo(line: number, column: number): TextRange {
|
|
142
|
+
const relative = this.clone();
|
|
143
|
+
|
|
144
|
+
if (this.startLine === line) {
|
|
145
|
+
relative.startColumn -= column;
|
|
146
|
+
}
|
|
147
|
+
if (this.endLine === line) {
|
|
148
|
+
relative.endColumn -= column;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
relative.startLine -= line;
|
|
152
|
+
relative.endLine -= line;
|
|
153
|
+
return relative;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
relativeFrom(line: number, column: number): TextRange {
|
|
157
|
+
const relative = this.clone();
|
|
158
|
+
|
|
159
|
+
if (this.startLine === 0) {
|
|
160
|
+
relative.startColumn += column;
|
|
161
|
+
}
|
|
162
|
+
if (this.endLine === 0) {
|
|
163
|
+
relative.endColumn += column;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
relative.startLine += line;
|
|
167
|
+
relative.endLine += line;
|
|
168
|
+
return relative;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
rebaseAfterTextEdit(originalRange: TextRange, editedRange: TextRange): TextRange {
|
|
172
|
+
console.assert(originalRange.startLine === editedRange.startLine);
|
|
173
|
+
console.assert(originalRange.startColumn === editedRange.startColumn);
|
|
174
|
+
const rebase = this.clone();
|
|
175
|
+
if (!this.follows(originalRange)) {
|
|
176
|
+
return rebase;
|
|
177
|
+
}
|
|
178
|
+
const lineDelta = editedRange.endLine - originalRange.endLine;
|
|
179
|
+
const columnDelta = editedRange.endColumn - originalRange.endColumn;
|
|
180
|
+
rebase.startLine += lineDelta;
|
|
181
|
+
rebase.endLine += lineDelta;
|
|
182
|
+
if (rebase.startLine === editedRange.endLine) {
|
|
183
|
+
rebase.startColumn += columnDelta;
|
|
184
|
+
}
|
|
185
|
+
if (rebase.endLine === editedRange.endLine) {
|
|
186
|
+
rebase.endColumn += columnDelta;
|
|
187
|
+
}
|
|
188
|
+
return rebase;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
toString(): string {
|
|
192
|
+
return JSON.stringify(this);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Checks whether this {@link TextRange} contains the location identified by the
|
|
197
|
+
* {@link lineNumber} and {@link columnNumber}. The beginning of the text range is
|
|
198
|
+
* considered inclusive while the end of the text range is considered exclusive
|
|
199
|
+
* for this comparison, meaning that for example a range `(0,1)-(1,4)` contains the
|
|
200
|
+
* location `(0,1)` but does not contain the location `(1,4)`.
|
|
201
|
+
*
|
|
202
|
+
* @param lineNumber the location's line offset.
|
|
203
|
+
* @param columnNumber the location's column offset.
|
|
204
|
+
* @returns `true` if the location identified by {@link lineNumber} and {@link columnNumber}
|
|
205
|
+
* is contained within this text range.
|
|
206
|
+
*/
|
|
207
|
+
containsLocation(lineNumber: number, columnNumber: number): boolean {
|
|
208
|
+
if (this.startLine === this.endLine) {
|
|
209
|
+
return this.startLine === lineNumber && this.startColumn <= columnNumber && columnNumber < this.endColumn;
|
|
210
|
+
}
|
|
211
|
+
if (this.startLine === lineNumber) {
|
|
212
|
+
return this.startColumn <= columnNumber;
|
|
213
|
+
}
|
|
214
|
+
if (this.endLine === lineNumber) {
|
|
215
|
+
return columnNumber < this.endColumn;
|
|
216
|
+
}
|
|
217
|
+
return this.startLine < lineNumber && lineNumber < this.endLine;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
get start(): {lineNumber: number, columnNumber: number} {
|
|
221
|
+
return {lineNumber: this.startLine, columnNumber: this.startColumn};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
get end(): {lineNumber: number, columnNumber: number} {
|
|
225
|
+
return {lineNumber: this.endLine, columnNumber: this.endColumn};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Checks whether this and `that` {@link TextRange} overlap and if they do, computes the
|
|
230
|
+
* intersection range. If they don't overlap an empty text range is returned instead (for
|
|
231
|
+
* which {@link #isEmpty()} yields `true`).
|
|
232
|
+
*
|
|
233
|
+
* The beginning of text ranges is considered to be includes while the end of the text
|
|
234
|
+
* ranges is considered exclusive for the intersection, meaning that for example intersecting
|
|
235
|
+
* `(0,1)-(1,4)` and `(1,4)-(1,6)` yields an empty range.
|
|
236
|
+
*
|
|
237
|
+
* @param that the other text range.
|
|
238
|
+
* @returns the intersection of this and `that` text range, which might be empty if their don't
|
|
239
|
+
* overlap.
|
|
240
|
+
*/
|
|
241
|
+
intersection(that: TextRange): TextRange {
|
|
242
|
+
let {startLine, startColumn} = this;
|
|
243
|
+
if (startLine < that.startLine) {
|
|
244
|
+
startLine = that.startLine;
|
|
245
|
+
startColumn = that.startColumn;
|
|
246
|
+
} else if (startLine === that.startLine) {
|
|
247
|
+
startColumn = Math.max(startColumn, that.startColumn);
|
|
248
|
+
}
|
|
249
|
+
let {endLine, endColumn} = this;
|
|
250
|
+
if (endLine > that.endLine) {
|
|
251
|
+
endLine = that.endLine;
|
|
252
|
+
endColumn = that.endColumn;
|
|
253
|
+
} else if (endLine === that.endLine) {
|
|
254
|
+
endColumn = Math.min(endColumn, that.endColumn);
|
|
255
|
+
}
|
|
256
|
+
if (startLine > endLine || (startLine === endLine && startColumn >= endColumn)) {
|
|
257
|
+
return new TextRange(0, 0, 0, 0);
|
|
258
|
+
}
|
|
259
|
+
return new TextRange(startLine, startColumn, endLine, endColumn);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export class SourceRange {
|
|
264
|
+
constructor(public offset: number, public length: number) {
|
|
265
|
+
}
|
|
266
|
+
}
|