chrome-devtools-frontend 1.0.950850 → 1.0.952284
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/config/gni/devtools_grd_files.gni +3 -3
- package/extension-api/ExtensionAPI.d.ts +1 -1
- package/front_end/.eslintrc.js +6 -0
- package/front_end/Tests.js +10 -0
- package/front_end/core/common/App.ts +0 -3
- package/front_end/core/common/AppProvider.ts +0 -3
- package/front_end/core/common/JavaScriptMetaData.ts +0 -3
- package/front_end/core/common/QueryParamHandler.ts +0 -3
- package/front_end/core/common/Runnable.ts +0 -3
- package/front_end/core/common/SimpleHistoryManager.ts +0 -3
- package/front_end/core/i18n/locales/en-US.json +183 -183
- package/front_end/core/i18n/locales/en-XL.json +183 -183
- package/front_end/core/sdk/CSSRule.ts +1 -1
- package/front_end/core/sdk/DOMModel.ts +12 -37
- package/front_end/core/sdk/OverlayModel.ts +18 -34
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -12
- package/front_end/core/sdk/RuntimeModel.ts +0 -1
- package/front_end/core/sdk/SourceMap.ts +1 -1
- package/front_end/core/sdk/TracingManager.ts +0 -3
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +36 -36
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +53 -53
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +11 -11
- package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +43 -43
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +106 -105
- package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +26 -26
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +51 -56
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +201 -204
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +84 -83
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +16 -16
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +21 -21
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +30 -30
- package/front_end/entrypoints/main/MainImpl.ts +12 -12
- package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +33 -33
- package/front_end/entrypoints/node_app/NodeMain.ts +35 -35
- package/front_end/generated/InspectorBackendCommands.js +5 -1
- package/front_end/generated/protocol.d.ts +16 -0
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +1 -2
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -4
- package/front_end/models/bindings/FileUtils.ts +0 -4
- package/front_end/models/bindings/IgnoreListManager.ts +1 -2
- package/front_end/models/bindings/NetworkProject.ts +1 -2
- package/front_end/models/extensions/ExtensionAPI.ts +2 -2
- package/front_end/models/extensions/ExtensionTraceProvider.ts +0 -3
- package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +6 -6
- package/front_end/models/issues_manager/ContrastCheckTrigger.ts +15 -15
- package/front_end/models/issues_manager/CorsIssue.ts +9 -9
- package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -5
- package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
- package/front_end/models/issues_manager/GenericIssue.ts +5 -5
- package/front_end/models/issues_manager/HeavyAdIssue.ts +5 -5
- package/front_end/models/issues_manager/Issue.ts +10 -10
- package/front_end/models/issues_manager/IssueResolver.ts +11 -10
- package/front_end/models/issues_manager/IssuesManager.ts +56 -56
- package/front_end/models/issues_manager/LowTextContrastIssue.ts +4 -4
- package/front_end/models/issues_manager/MixedContentIssue.ts +7 -7
- package/front_end/models/issues_manager/NavigatorUserAgentIssue.ts +7 -7
- package/front_end/models/issues_manager/QuirksModeIssue.ts +4 -4
- package/front_end/models/issues_manager/SameSiteCookieIssue.ts +17 -18
- package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +5 -5
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +32 -31
- package/front_end/models/issues_manager/TrustedWebActivityIssue.ts +5 -5
- package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +5 -5
- package/front_end/models/timeline_model/TimelineModel.ts +1 -1
- package/front_end/models/timeline_model/TracingLayerTree.ts +0 -1
- package/front_end/panels/accessibility/ARIAMetadata.ts +0 -1
- package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +2 -2
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +1 -2
- package/front_end/panels/animation/AnimationTimeline.ts +0 -1
- package/front_end/panels/application/ApplicationPanelCacheSection.ts +3 -4
- package/front_end/panels/application/ServiceWorkerUpdateCycleView.ts +0 -2
- package/front_end/panels/application/StorageView.ts +2 -6
- package/front_end/panels/application/{BackForwardCacheStrings.ts → components/BackForwardCacheStrings.ts} +2 -2
- package/front_end/panels/application/{BackForwardCacheView.ts → components/BackForwardCacheView.ts} +96 -62
- package/front_end/panels/application/components/EndpointsGrid.ts +12 -12
- package/front_end/panels/application/components/FrameDetailsView.ts +108 -110
- package/front_end/panels/application/components/OriginTrialTreeView.ts +45 -45
- package/front_end/panels/application/components/PermissionsPolicySection.ts +19 -19
- package/front_end/panels/application/components/ReportsGrid.ts +30 -30
- package/front_end/panels/application/components/StackTrace.ts +48 -47
- package/front_end/panels/application/components/TrustTokensView.ts +31 -31
- package/front_end/panels/application/{backForwardCacheView.css → components/backForwardCacheView.css} +9 -0
- package/front_end/panels/application/components/components.ts +2 -0
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -25
- package/front_end/panels/console/consoleView.css +5 -0
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +41 -52
- package/front_end/panels/css_overview/CSSOverviewController.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +18 -27
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +6 -6
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
- package/front_end/panels/elements/ComputedStyleModel.ts +2 -2
- package/front_end/panels/elements/ElementsPanel.ts +1 -5
- package/front_end/panels/elements/ElementsTreeElement.ts +2 -6
- package/front_end/panels/elements/ElementsTreeOutline.ts +2 -2
- package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +17 -17
- package/front_end/panels/elements/components/AdornerManager.ts +21 -21
- package/front_end/panels/elements/components/AdornerSettingsPane.ts +14 -14
- package/front_end/panels/elements/components/CSSQuery.ts +16 -16
- package/front_end/panels/elements/components/ComputedStyleProperty.ts +14 -14
- package/front_end/panels/elements/components/ComputedStyleTrace.ts +15 -15
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +78 -78
- package/front_end/panels/elements/components/ElementsPanelLink.ts +16 -16
- package/front_end/panels/elements/components/LayoutPane.ts +47 -47
- package/front_end/panels/elements/components/NodeText.ts +18 -18
- package/front_end/panels/elements/components/QueryContainer.ts +40 -40
- package/front_end/panels/elements/components/StylePropertyEditor.ts +18 -18
- package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +4 -4
- package/front_end/panels/event_listeners/EventListenersUtils.ts +2 -1
- package/front_end/panels/issues/AffectedBlockedByResponseView.ts +4 -4
- package/front_end/panels/issues/AffectedCookiesView.ts +4 -5
- package/front_end/panels/issues/AffectedDirectivesView.ts +19 -19
- package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +7 -8
- package/front_end/panels/issues/AffectedElementsView.ts +4 -4
- package/front_end/panels/issues/AffectedElementsWithLowContrastView.ts +7 -8
- package/front_end/panels/issues/AffectedHeavyAdView.ts +8 -8
- package/front_end/panels/issues/AffectedResourcesView.ts +25 -26
- package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +8 -8
- package/front_end/panels/issues/AffectedSourcesView.ts +4 -4
- package/front_end/panels/issues/AffectedTrustedWebActivityIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +17 -17
- package/front_end/panels/issues/CSPViolationsListView.ts +22 -23
- package/front_end/panels/issues/CSPViolationsView.ts +17 -17
- package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +13 -13
- package/front_end/panels/issues/CorsIssueDetailsView.ts +23 -23
- package/front_end/panels/issues/GenericIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/HiddenIssuesRow.ts +7 -7
- package/front_end/panels/issues/IssueAggregator.ts +95 -95
- package/front_end/panels/issues/IssueKindView.ts +14 -14
- package/front_end/panels/issues/IssueView.ts +98 -98
- package/front_end/panels/issues/IssuesPane.ts +102 -102
- package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +5 -5
- package/front_end/panels/issues/components/HideIssuesMenu.ts +10 -10
- package/front_end/panels/layer_viewer/Layers3DView.ts +3 -9
- package/front_end/panels/lighthouse/LighthouseController.ts +4 -5
- package/front_end/panels/media/PlayerListView.ts +160 -97
- package/front_end/panels/media/PlayerMessagesView.ts +1 -0
- package/front_end/panels/media/TickingFlameChart.ts +1 -2
- package/front_end/panels/media/playerListView.css +58 -0
- package/front_end/panels/network/NetworkLogView.ts +2 -6
- package/front_end/panels/network/NetworkLogViewColumns.ts +1 -1
- package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -4
- package/front_end/panels/network/components/RequestTrustTokensView.ts +40 -40
- package/front_end/panels/network/components/WebBundleInfoView.ts +9 -9
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +6 -12
- package/front_end/panels/profiler/HeapProfileView.ts +1 -1
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +0 -1
- package/front_end/panels/profiler/HeapSnapshotView.ts +1 -2
- package/front_end/panels/profiler/heapProfiler.css +1 -1
- package/front_end/panels/search/SearchConfig.ts +0 -6
- package/front_end/panels/security/SecurityModel.ts +2 -4
- package/front_end/panels/security/SecurityPanel.ts +2 -2
- package/front_end/panels/settings/KeybindsSettingsTab.ts +4 -0
- package/front_end/panels/settings/components/SyncSection.ts +14 -14
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +96 -96
- package/front_end/panels/settings/settingsScreen.css +8 -3
- package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
- package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +2 -2
- package/front_end/panels/sources/NavigatorView.ts +4 -10
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +2 -3
- package/front_end/panels/sources/SourceMapNamesResolver.ts +3 -3
- package/front_end/panels/sources/SourcesPanel.ts +1 -3
- package/front_end/panels/sources/SourcesView.ts +0 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +1 -4
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +2 -5
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +0 -1
- package/front_end/panels/timeline/TimelineFlameChartView.ts +0 -1
- package/front_end/panels/timeline/TimelineLoader.ts +0 -3
- package/front_end/panels/timeline/TimelinePanel.ts +2 -3
- package/front_end/panels/timeline/TimelineUIUtils.ts +1 -1
- package/front_end/panels/timeline/components/WebVitalsLane.ts +77 -76
- package/front_end/panels/timeline/components/WebVitalsTimeline.ts +133 -133
- package/front_end/panels/timeline/components/WebVitalsTooltip.ts +9 -9
- package/front_end/panels/webauthn/WebauthnPane.ts +203 -205
- package/front_end/third_party/codemirror.next/bundle.ts +3 -3
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +10 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +2 -1
- package/front_end/third_party/codemirror.next/package.json +3 -3
- package/front_end/third_party/puppeteer/package/README.md +11 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts +4 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts +4 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.d.ts +1 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts +1 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts +1 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts +9 -7
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js +21 -12
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts +1 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts +1 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts +3 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts +1 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts +8 -10
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts +50 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js +70 -33
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts +12 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js +25 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts +2 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts +39 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js +36 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts +3 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js +2 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkEventManager.d.ts +46 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkEventManager.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkEventManager.js +124 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkEventManager.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts +27 -10
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.js +144 -74
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Puppeteer.d.ts +5 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.d.ts +1 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.d.ts +4 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts +3 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts +4 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js +43 -17
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts +1 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js +101 -34
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts +1 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.d.ts +1 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.d.ts +5 -7
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.d.ts +4 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.d.ts +4 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js +2 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts +1 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +3 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.d.ts +1 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.d.ts +1 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.js +1 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts +9 -7
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js +24 -17
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Dialog.d.ts +1 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EvalTypes.d.ts +1 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.d.ts +3 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FileChooser.d.ts +1 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts +8 -10
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js +7 -8
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.d.ts +50 -11
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.js +70 -34
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.d.ts +12 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.js +26 -7
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.d.ts +2 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts +39 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js +38 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts +3 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.js +4 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkEventManager.d.ts +46 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkEventManager.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkEventManager.js +120 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkEventManager.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.d.ts +27 -10
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js +144 -75
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js +12 -14
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.d.ts +5 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js +3 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.d.ts +1 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Target.d.ts +4 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.d.ts +3 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js +1 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js +3 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js +1 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js +10 -12
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.d.ts +4 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js +43 -20
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts +1 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js +104 -40
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts +1 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.d.ts +1 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js +1 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts +5 -7
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js +1 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js +3 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js +1 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.js +1 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.js +1 -2
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +173 -36
- package/front_end/third_party/puppeteer/package/package.json +3 -3
- package/front_end/ui/components/adorners/Adorner.ts +2 -2
- package/front_end/ui/components/buttons/Button.ts +9 -9
- package/front_end/ui/components/data_grid/DataGrid.ts +62 -62
- package/front_end/ui/components/data_grid/DataGridController.ts +22 -22
- package/front_end/ui/components/diff_view/DiffView.ts +6 -6
- package/front_end/ui/components/expandable_list/ExpandableList.ts +5 -5
- package/front_end/ui/components/icon_button/Icon.ts +4 -4
- package/front_end/ui/components/icon_button/IconButton.ts +4 -4
- package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +50 -50
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -6
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +4 -4
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +12 -12
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +40 -39
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +18 -18
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -4
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +5 -5
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +2 -2
- package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -5
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +2 -2
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +2 -2
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +4 -4
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +22 -22
- package/front_end/ui/components/report_view/ReportView.ts +16 -16
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +14 -14
- package/front_end/ui/components/settings/SettingCheckbox.ts +5 -5
- package/front_end/ui/components/survey_link/SurveyLink.ts +8 -8
- package/front_end/ui/components/text_editor/TextEditor.ts +9 -9
- package/front_end/ui/components/text_editor/cursor_tooltip.ts +7 -1
- package/front_end/ui/components/text_prompt/TextPrompt.ts +18 -18
- package/front_end/ui/components/tree_outline/TreeOutline.ts +69 -70
- package/front_end/ui/legacy/ContextFlavorListener.ts +0 -4
- package/front_end/ui/legacy/ContextMenu.ts +2 -3
- package/front_end/ui/legacy/InspectorView.ts +1 -1
- package/front_end/ui/legacy/ReportView.ts +3 -4
- package/front_end/ui/legacy/SearchableView.ts +1 -2
- package/front_end/ui/legacy/SplitWidget.ts +2 -3
- package/front_end/ui/legacy/SuggestBox.ts +0 -3
- package/front_end/ui/legacy/TextPrompt.ts +1 -1
- package/front_end/ui/legacy/UIUtils.ts +1 -1
- package/front_end/ui/legacy/XLink.ts +1 -1
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +2 -2
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +9 -9
- package/front_end/ui/legacy/components/data_grid/dataGrid.css +7 -7
- package/front_end/ui/legacy/components/inline_editor/CSSShadowEditor.ts +1 -1
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +1 -5
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +0 -1
- package/front_end/ui/legacy/components/utils/Linkifier.ts +2 -2
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +24 -1
- package/inspector_overlay/main.ts +16 -2
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/use_private_class_members.js +41 -0
- package/scripts/eslint_rules/tests/use_private_class_members_test.js +62 -0
- package/scripts/migration/class-fields/migrate.js +2 -3
- package/scripts/migration/class-fields/migrate.sh +1 -3
- package/scripts/migration/class-fields/package.json +1 -1
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
export class FormattedContentBuilder {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
#lastOriginalPosition = 0;
|
|
7
|
+
#formattedContent: string[] = [];
|
|
8
|
+
#formattedContentLength = 0;
|
|
9
|
+
#lastFormattedPosition = 0;
|
|
10
|
+
#nestingLevel = 0;
|
|
11
|
+
#newLines = 0;
|
|
12
|
+
#enforceSpaceBetweenWords = true;
|
|
13
|
+
#softSpace = false;
|
|
14
|
+
#hardSpaces = 0;
|
|
15
|
+
#cachedIndents = new Map<number, string>();
|
|
16
16
|
|
|
17
17
|
mapping = {original: [0], formatted: [0]};
|
|
18
18
|
|
|
@@ -20,14 +20,14 @@ export class FormattedContentBuilder {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
setEnforceSpaceBetweenWords(value: boolean): boolean {
|
|
23
|
-
const oldValue = this
|
|
24
|
-
this
|
|
23
|
+
const oldValue = this.#enforceSpaceBetweenWords;
|
|
24
|
+
this.#enforceSpaceBetweenWords = value;
|
|
25
25
|
return oldValue;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
addToken(token: string, offset: number): void {
|
|
29
|
-
const last = this
|
|
30
|
-
if (this
|
|
29
|
+
const last = this.#formattedContent[this.#formattedContent.length - 1];
|
|
30
|
+
if (this.#enforceSpaceBetweenWords && last && /\w/.test(last[last.length - 1]) && /\w/.test(token)) {
|
|
31
31
|
this.addSoftSpace();
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -39,91 +39,91 @@ export class FormattedContentBuilder {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
addSoftSpace(): void {
|
|
42
|
-
if (!this
|
|
43
|
-
this
|
|
42
|
+
if (!this.#hardSpaces) {
|
|
43
|
+
this.#softSpace = true;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
addHardSpace(): void {
|
|
48
|
-
this
|
|
49
|
-
++this
|
|
48
|
+
this.#softSpace = false;
|
|
49
|
+
++this.#hardSpaces;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
addNewLine(noSquash?: boolean): void {
|
|
53
53
|
// Avoid leading newlines.
|
|
54
|
-
if (!this
|
|
54
|
+
if (!this.#formattedContentLength) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
if (noSquash) {
|
|
58
|
-
++this
|
|
58
|
+
++this.#newLines;
|
|
59
59
|
} else {
|
|
60
|
-
this
|
|
60
|
+
this.#newLines = this.#newLines || 1;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
increaseNestingLevel(): void {
|
|
65
|
-
this
|
|
65
|
+
this.#nestingLevel += 1;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
decreaseNestingLevel(): void {
|
|
69
|
-
if (this
|
|
70
|
-
this
|
|
69
|
+
if (this.#nestingLevel > 0) {
|
|
70
|
+
this.#nestingLevel -= 1;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
content(): string {
|
|
75
|
-
return this
|
|
75
|
+
return this.#formattedContent.join('') + (this.#newLines ? '\n' : '');
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
private appendFormatting(): void {
|
|
79
|
-
if (this
|
|
80
|
-
for (let i = 0; i < this
|
|
79
|
+
if (this.#newLines) {
|
|
80
|
+
for (let i = 0; i < this.#newLines; ++i) {
|
|
81
81
|
this.addText('\n');
|
|
82
82
|
}
|
|
83
83
|
this.addText(this.indent());
|
|
84
|
-
} else if (this
|
|
84
|
+
} else if (this.#softSpace) {
|
|
85
85
|
this.addText(' ');
|
|
86
86
|
}
|
|
87
|
-
if (this
|
|
88
|
-
for (let i = 0; i < this
|
|
87
|
+
if (this.#hardSpaces) {
|
|
88
|
+
for (let i = 0; i < this.#hardSpaces; ++i) {
|
|
89
89
|
this.addText(' ');
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
this
|
|
93
|
-
this
|
|
94
|
-
this
|
|
92
|
+
this.#newLines = 0;
|
|
93
|
+
this.#softSpace = false;
|
|
94
|
+
this.#hardSpaces = 0;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
private indent(): string {
|
|
98
|
-
const cachedValue = this
|
|
98
|
+
const cachedValue = this.#cachedIndents.get(this.#nestingLevel);
|
|
99
99
|
if (cachedValue) {
|
|
100
100
|
return cachedValue;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
let fullIndent = '';
|
|
104
|
-
for (let i = 0; i < this
|
|
104
|
+
for (let i = 0; i < this.#nestingLevel; ++i) {
|
|
105
105
|
fullIndent += this.indentString;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// Cache a maximum of 20 nesting level indents.
|
|
109
|
-
if (this
|
|
110
|
-
this
|
|
109
|
+
if (this.#nestingLevel <= 20) {
|
|
110
|
+
this.#cachedIndents.set(this.#nestingLevel, fullIndent);
|
|
111
111
|
}
|
|
112
112
|
return fullIndent;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
private addText(text: string): void {
|
|
116
|
-
this
|
|
117
|
-
this
|
|
116
|
+
this.#formattedContent.push(text);
|
|
117
|
+
this.#formattedContentLength += text.length;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
private addMappingIfNeeded(originalPosition: number): void {
|
|
121
|
-
if (originalPosition - this
|
|
121
|
+
if (originalPosition - this.#lastOriginalPosition === this.#formattedContentLength - this.#lastFormattedPosition) {
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
this.mapping.original.push(originalPosition);
|
|
125
|
-
this
|
|
126
|
-
this.mapping.formatted.push(this
|
|
127
|
-
this
|
|
125
|
+
this.#lastOriginalPosition = originalPosition;
|
|
126
|
+
this.mapping.formatted.push(this.#formattedContentLength);
|
|
127
|
+
this.#lastFormattedPosition = this.#formattedContentLength;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -10,36 +10,36 @@ import {AbortTokenization, createTokenizer} from './FormatterWorker.js';
|
|
|
10
10
|
import {JavaScriptFormatter} from './JavaScriptFormatter.js';
|
|
11
11
|
|
|
12
12
|
export class HTMLFormatter {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
readonly #builder: FormattedContentBuilder;
|
|
14
|
+
readonly #jsFormatter: JavaScriptFormatter;
|
|
15
|
+
readonly #cssFormatter: CSSFormatter;
|
|
16
|
+
#text?: string;
|
|
17
|
+
#lineEndings?: number[];
|
|
18
|
+
#model?: HTMLModel;
|
|
19
19
|
|
|
20
20
|
constructor(builder: FormattedContentBuilder) {
|
|
21
|
-
this
|
|
22
|
-
this
|
|
23
|
-
this
|
|
21
|
+
this.#builder = builder;
|
|
22
|
+
this.#jsFormatter = new JavaScriptFormatter(builder);
|
|
23
|
+
this.#cssFormatter = new CSSFormatter(builder);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
format(text: string, lineEndings: number[]): void {
|
|
27
|
-
this
|
|
28
|
-
this
|
|
29
|
-
this
|
|
30
|
-
this.walk(this
|
|
27
|
+
this.#text = text;
|
|
28
|
+
this.#lineEndings = lineEndings;
|
|
29
|
+
this.#model = new HTMLModel(text);
|
|
30
|
+
this.walk(this.#model.document());
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
private formatTokensTill(element: FormatterElement, offset: number): void {
|
|
34
|
-
if (!this
|
|
34
|
+
if (!this.#model) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
let nextToken = this
|
|
38
|
+
let nextToken = this.#model.peekToken();
|
|
39
39
|
while (nextToken && nextToken.startOffset < offset) {
|
|
40
|
-
const token = (this
|
|
40
|
+
const token = (this.#model.nextToken() as Token);
|
|
41
41
|
this.formatToken(element, token);
|
|
42
|
-
nextToken = this
|
|
42
|
+
nextToken = this.#model.peekToken();
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -65,42 +65,42 @@ export class HTMLFormatter {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
private beforeOpenTag(element: FormatterElement): void {
|
|
68
|
-
if (!this
|
|
68
|
+
if (!this.#model) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
if (!element.children.length || element === this
|
|
72
|
+
if (!element.children.length || element === this.#model.document()) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
this
|
|
75
|
+
this.#builder.addNewLine();
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
private afterOpenTag(element: FormatterElement): void {
|
|
79
|
-
if (!this
|
|
79
|
+
if (!this.#model) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
if (!element.children.length || element === this
|
|
83
|
+
if (!element.children.length || element === this.#model.document()) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
this
|
|
87
|
-
this
|
|
86
|
+
this.#builder.increaseNestingLevel();
|
|
87
|
+
this.#builder.addNewLine();
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
private beforeCloseTag(element: FormatterElement): void {
|
|
91
|
-
if (!this
|
|
91
|
+
if (!this.#model) {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
if (!element.children.length || element === this
|
|
95
|
+
if (!element.children.length || element === this.#model.document()) {
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
-
this
|
|
99
|
-
this
|
|
98
|
+
this.#builder.decreaseNestingLevel();
|
|
99
|
+
this.#builder.addNewLine();
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
private afterCloseTag(_element: FormatterElement): void {
|
|
103
|
-
this
|
|
103
|
+
this.#builder.addNewLine();
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
private formatToken(element: FormatterElement, token: Token): void {
|
|
@@ -108,9 +108,9 @@ export class HTMLFormatter {
|
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
if (hasTokenInSet(token.type, 'comment') || hasTokenInSet(token.type, 'meta')) {
|
|
111
|
-
this
|
|
112
|
-
this
|
|
113
|
-
this
|
|
111
|
+
this.#builder.addNewLine();
|
|
112
|
+
this.#builder.addToken(token.value.trim(), token.startOffset);
|
|
113
|
+
this.#builder.addNewLine();
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -121,30 +121,30 @@ export class HTMLFormatter {
|
|
|
121
121
|
const isBodyToken =
|
|
122
122
|
element.openTag.endOffset <= token.startOffset && token.startOffset < element.closeTag.startOffset;
|
|
123
123
|
if (isBodyToken && element.name === 'style') {
|
|
124
|
-
this
|
|
125
|
-
this
|
|
126
|
-
this
|
|
127
|
-
this
|
|
124
|
+
this.#builder.addNewLine();
|
|
125
|
+
this.#builder.increaseNestingLevel();
|
|
126
|
+
this.#cssFormatter.format(this.#text || '', this.#lineEndings || [], token.startOffset, token.endOffset);
|
|
127
|
+
this.#builder.decreaseNestingLevel();
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
if (isBodyToken && element.name === 'script') {
|
|
131
|
-
this
|
|
132
|
-
this
|
|
131
|
+
this.#builder.addNewLine();
|
|
132
|
+
this.#builder.increaseNestingLevel();
|
|
133
133
|
if (this.scriptTagIsJavaScript(element)) {
|
|
134
|
-
this
|
|
134
|
+
this.#jsFormatter.format(this.#text || '', this.#lineEndings || [], token.startOffset, token.endOffset);
|
|
135
135
|
} else {
|
|
136
|
-
this
|
|
137
|
-
this
|
|
136
|
+
this.#builder.addToken(token.value, token.startOffset);
|
|
137
|
+
this.#builder.addNewLine();
|
|
138
138
|
}
|
|
139
|
-
this
|
|
139
|
+
this.#builder.decreaseNestingLevel();
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
if (!isBodyToken && hasTokenInSet(token.type, 'attribute')) {
|
|
144
|
-
this
|
|
144
|
+
this.#builder.addSoftSpace();
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
this
|
|
147
|
+
this.#builder.addToken(token.value, token.startOffset);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
private scriptTagIsJavaScript(element: FormatterElement): boolean {
|
|
@@ -200,34 +200,34 @@ function hasTokenInSet(tokenTypes: Set<string>, type: string): boolean {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
export class HTMLModel {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
203
|
+
#state: ParseState;
|
|
204
|
+
readonly #documentInternal: FormatterElement;
|
|
205
|
+
#stack: FormatterElement[];
|
|
206
|
+
readonly #tokens: Token[];
|
|
207
|
+
#tokenIndex: number;
|
|
208
|
+
#attributes: Map<string, string>;
|
|
209
|
+
#attributeName: string;
|
|
210
|
+
#tagName: string;
|
|
211
|
+
#isOpenTag: boolean;
|
|
212
|
+
#tagStartOffset?: number|null;
|
|
213
|
+
#tagEndOffset?: number|null;
|
|
214
214
|
|
|
215
215
|
constructor(text: string) {
|
|
216
|
-
this
|
|
217
|
-
this
|
|
218
|
-
this
|
|
219
|
-
this
|
|
216
|
+
this.#state = ParseState.Initial;
|
|
217
|
+
this.#documentInternal = new FormatterElement('document');
|
|
218
|
+
this.#documentInternal.openTag = new Tag('document', 0, 0, new Map(), true, false);
|
|
219
|
+
this.#documentInternal.closeTag = new Tag('document', text.length, text.length, new Map(), false, false);
|
|
220
220
|
|
|
221
|
-
this
|
|
221
|
+
this.#stack = [this.#documentInternal];
|
|
222
222
|
|
|
223
|
-
this
|
|
224
|
-
this
|
|
223
|
+
this.#tokens = [];
|
|
224
|
+
this.#tokenIndex = 0;
|
|
225
225
|
this.build(text);
|
|
226
226
|
|
|
227
|
-
this
|
|
228
|
-
this
|
|
229
|
-
this
|
|
230
|
-
this
|
|
227
|
+
this.#attributes = new Map();
|
|
228
|
+
this.#attributeName = '';
|
|
229
|
+
this.#tagName = '';
|
|
230
|
+
this.#isOpenTag = false;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
private build(text: string): void {
|
|
@@ -240,7 +240,7 @@ export class HTMLModel {
|
|
|
240
240
|
if (lastOffset >= text.length) {
|
|
241
241
|
break;
|
|
242
242
|
}
|
|
243
|
-
const element = this
|
|
243
|
+
const element = this.#stack[this.#stack.length - 1];
|
|
244
244
|
if (!element) {
|
|
245
245
|
break;
|
|
246
246
|
}
|
|
@@ -257,11 +257,11 @@ export class HTMLModel {
|
|
|
257
257
|
const tokenStart = element.openTag.endOffset;
|
|
258
258
|
const tokenEnd = lastOffset;
|
|
259
259
|
const tokenValue = text.substring(tokenStart, tokenEnd);
|
|
260
|
-
this
|
|
260
|
+
this.#tokens.push(new Token(tokenValue, new Set(), tokenStart, tokenEnd));
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
while (this
|
|
264
|
-
const element = this
|
|
263
|
+
while (this.#stack.length > 1) {
|
|
264
|
+
const element = this.#stack[this.#stack.length - 1];
|
|
265
265
|
if (!element) {
|
|
266
266
|
break;
|
|
267
267
|
}
|
|
@@ -278,10 +278,10 @@ export class HTMLModel {
|
|
|
278
278
|
|
|
279
279
|
const tokenType = type ? new Set<string>(type.split(' ')) : new Set<string>();
|
|
280
280
|
const token = new Token(tokenValue, tokenType, tokenStart, tokenEnd);
|
|
281
|
-
this
|
|
281
|
+
this.#tokens.push(token);
|
|
282
282
|
this.updateDOM(token);
|
|
283
283
|
|
|
284
|
-
const element = this
|
|
284
|
+
const element = this.#stack[this.#stack.length - 1];
|
|
285
285
|
if (element && (element.name === 'script' || element.name === 'style') && element.openTag &&
|
|
286
286
|
element.openTag.endOffset === lastOffset) {
|
|
287
287
|
return AbortTokenization;
|
|
@@ -294,68 +294,69 @@ export class HTMLModel {
|
|
|
294
294
|
private updateDOM(token: Token): void {
|
|
295
295
|
const value = token.value;
|
|
296
296
|
const type = token.type;
|
|
297
|
-
switch (this
|
|
297
|
+
switch (this.#state) {
|
|
298
298
|
case ParseState.Initial:
|
|
299
299
|
if (hasTokenInSet(type, 'bracket') && (value === '<' || value === '</')) {
|
|
300
300
|
this.onStartTag(token);
|
|
301
|
-
this
|
|
301
|
+
this.#state = ParseState.Tag;
|
|
302
302
|
}
|
|
303
303
|
return;
|
|
304
304
|
case ParseState.Tag:
|
|
305
305
|
if (hasTokenInSet(type, 'tag') && !hasTokenInSet(type, 'bracket')) {
|
|
306
|
-
this
|
|
306
|
+
this.#tagName = value.trim().toLowerCase();
|
|
307
307
|
} else if (hasTokenInSet(type, 'attribute')) {
|
|
308
|
-
this
|
|
309
|
-
this
|
|
310
|
-
this
|
|
308
|
+
this.#attributeName = value.trim().toLowerCase();
|
|
309
|
+
this.#attributes.set(this.#attributeName, '');
|
|
310
|
+
this.#state = ParseState.AttributeName;
|
|
311
311
|
} else if (hasTokenInSet(type, 'bracket') && (value === '>' || value === '/>')) {
|
|
312
312
|
this.onEndTag(token);
|
|
313
|
-
this
|
|
313
|
+
this.#state = ParseState.Initial;
|
|
314
314
|
}
|
|
315
315
|
return;
|
|
316
316
|
case ParseState.AttributeName:
|
|
317
317
|
if (!type.size && value === '=') {
|
|
318
|
-
this
|
|
318
|
+
this.#state = ParseState.AttributeValue;
|
|
319
319
|
} else if (hasTokenInSet(type, 'bracket') && (value === '>' || value === '/>')) {
|
|
320
320
|
this.onEndTag(token);
|
|
321
|
-
this
|
|
321
|
+
this.#state = ParseState.Initial;
|
|
322
322
|
}
|
|
323
323
|
return;
|
|
324
324
|
case ParseState.AttributeValue:
|
|
325
325
|
if (hasTokenInSet(type, 'string')) {
|
|
326
|
-
this
|
|
327
|
-
this
|
|
326
|
+
this.#attributes.set(this.#attributeName, value);
|
|
327
|
+
this.#state = ParseState.Tag;
|
|
328
328
|
} else if (hasTokenInSet(type, 'bracket') && (value === '>' || value === '/>')) {
|
|
329
329
|
this.onEndTag(token);
|
|
330
|
-
this
|
|
330
|
+
this.#state = ParseState.Initial;
|
|
331
331
|
}
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
private onStartTag(token: Token): void {
|
|
337
|
-
this
|
|
338
|
-
this
|
|
339
|
-
this
|
|
340
|
-
this
|
|
341
|
-
this
|
|
342
|
-
this
|
|
337
|
+
this.#tagName = '';
|
|
338
|
+
this.#tagStartOffset = token.startOffset;
|
|
339
|
+
this.#tagEndOffset = null;
|
|
340
|
+
this.#attributes = new Map();
|
|
341
|
+
this.#attributeName = '';
|
|
342
|
+
this.#isOpenTag = token.value === '<';
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
private onEndTag(token: Token): void {
|
|
346
|
-
this
|
|
347
|
-
const selfClosingTag = token.value === '/>' || SelfClosingTags.has(this
|
|
346
|
+
this.#tagEndOffset = token.endOffset;
|
|
347
|
+
const selfClosingTag = token.value === '/>' || SelfClosingTags.has(this.#tagName);
|
|
348
348
|
const tag = new Tag(
|
|
349
|
-
this
|
|
349
|
+
this.#tagName, this.#tagStartOffset || 0, this.#tagEndOffset, this.#attributes, this.#isOpenTag,
|
|
350
|
+
selfClosingTag);
|
|
350
351
|
this.onTagComplete(tag);
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
private onTagComplete(tag: Tag): void {
|
|
354
355
|
if (tag.isOpenTag) {
|
|
355
|
-
const topElement = this
|
|
356
|
+
const topElement = this.#stack[this.#stack.length - 1];
|
|
356
357
|
if (topElement) {
|
|
357
358
|
const tagSet = AutoClosingTags.get(topElement.name);
|
|
358
|
-
if (topElement !== this
|
|
359
|
+
if (topElement !== this.#documentInternal && topElement.openTag && topElement.openTag.selfClosingTag) {
|
|
359
360
|
this.popElement(autocloseTag(topElement, topElement.openTag.endOffset));
|
|
360
361
|
} else if (tagSet && tagSet.has(tag.name)) {
|
|
361
362
|
this.popElement(autocloseTag(topElement, tag.startOffset));
|
|
@@ -365,12 +366,12 @@ export class HTMLModel {
|
|
|
365
366
|
return;
|
|
366
367
|
}
|
|
367
368
|
|
|
368
|
-
let lastTag = this
|
|
369
|
-
while (this
|
|
369
|
+
let lastTag = this.#stack[this.#stack.length - 1];
|
|
370
|
+
while (this.#stack.length > 1 && lastTag && lastTag.name !== tag.name) {
|
|
370
371
|
this.popElement(autocloseTag(lastTag, tag.startOffset));
|
|
371
|
-
lastTag = this
|
|
372
|
+
lastTag = this.#stack[this.#stack.length - 1];
|
|
372
373
|
}
|
|
373
|
-
if (this
|
|
374
|
+
if (this.#stack.length === 1) {
|
|
374
375
|
return;
|
|
375
376
|
}
|
|
376
377
|
this.popElement(tag);
|
|
@@ -381,7 +382,7 @@ export class HTMLModel {
|
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
private popElement(closeTag: Tag): void {
|
|
384
|
-
const element = this
|
|
385
|
+
const element = this.#stack.pop();
|
|
385
386
|
if (!element) {
|
|
386
387
|
return;
|
|
387
388
|
}
|
|
@@ -389,26 +390,26 @@ export class HTMLModel {
|
|
|
389
390
|
}
|
|
390
391
|
|
|
391
392
|
private pushElement(openTag: Tag): void {
|
|
392
|
-
const topElement = this
|
|
393
|
+
const topElement = this.#stack[this.#stack.length - 1];
|
|
393
394
|
const newElement = new FormatterElement(openTag.name);
|
|
394
395
|
if (topElement) {
|
|
395
396
|
newElement.parent = topElement;
|
|
396
397
|
topElement.children.push(newElement);
|
|
397
398
|
}
|
|
398
399
|
newElement.openTag = openTag;
|
|
399
|
-
this
|
|
400
|
+
this.#stack.push(newElement);
|
|
400
401
|
}
|
|
401
402
|
|
|
402
403
|
peekToken(): Token|null {
|
|
403
|
-
return this
|
|
404
|
+
return this.#tokenIndex < this.#tokens.length ? this.#tokens[this.#tokenIndex] : null;
|
|
404
405
|
}
|
|
405
406
|
|
|
406
407
|
nextToken(): Token|null {
|
|
407
|
-
return this
|
|
408
|
+
return this.#tokens[this.#tokenIndex++];
|
|
408
409
|
}
|
|
409
410
|
|
|
410
411
|
document(): FormatterElement {
|
|
411
|
-
return this
|
|
412
|
+
return this.#documentInternal;
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
415
|
|
|
@@ -36,23 +36,23 @@ import {ESTreeWalker} from './ESTreeWalker.js';
|
|
|
36
36
|
import type {FormattedContentBuilder} from './FormattedContentBuilder.js';
|
|
37
37
|
|
|
38
38
|
export class JavaScriptFormatter {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
readonly #builder: FormattedContentBuilder;
|
|
40
|
+
#tokenizer!: AcornTokenizer;
|
|
41
|
+
#content!: string;
|
|
42
|
+
#fromOffset!: number;
|
|
43
|
+
#lastLineNumber!: number;
|
|
44
|
+
#toOffset?: number;
|
|
45
45
|
constructor(builder: FormattedContentBuilder) {
|
|
46
|
-
this
|
|
46
|
+
this.#builder = builder;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
format(text: string, lineEndings: number[], fromOffset: number, toOffset: number): void {
|
|
50
|
-
this
|
|
51
|
-
this
|
|
52
|
-
this
|
|
53
|
-
this
|
|
54
|
-
this
|
|
55
|
-
const ast = Acorn.parse(this
|
|
50
|
+
this.#fromOffset = fromOffset;
|
|
51
|
+
this.#toOffset = toOffset;
|
|
52
|
+
this.#content = text.substring(this.#fromOffset, this.#toOffset);
|
|
53
|
+
this.#lastLineNumber = 0;
|
|
54
|
+
this.#tokenizer = new AcornTokenizer(this.#content);
|
|
55
|
+
const ast = Acorn.parse(this.#content, {
|
|
56
56
|
ranges: false,
|
|
57
57
|
preserveParens: true,
|
|
58
58
|
allowImportExportEverywhere: true,
|
|
@@ -70,22 +70,22 @@ export class JavaScriptFormatter {
|
|
|
70
70
|
private push(token: Acorn.Token|Acorn.Comment|null, format: string): void {
|
|
71
71
|
for (let i = 0; i < format.length; ++i) {
|
|
72
72
|
if (format[i] === 's') {
|
|
73
|
-
this
|
|
73
|
+
this.#builder.addSoftSpace();
|
|
74
74
|
} else if (format[i] === 'S') {
|
|
75
|
-
this
|
|
75
|
+
this.#builder.addHardSpace();
|
|
76
76
|
} else if (format[i] === 'n') {
|
|
77
|
-
this
|
|
77
|
+
this.#builder.addNewLine();
|
|
78
78
|
} else if (format[i] === '>') {
|
|
79
|
-
this
|
|
79
|
+
this.#builder.increaseNestingLevel();
|
|
80
80
|
} else if (format[i] === '<') {
|
|
81
|
-
this
|
|
81
|
+
this.#builder.decreaseNestingLevel();
|
|
82
82
|
} else if (format[i] === 't') {
|
|
83
|
-
if (this
|
|
84
|
-
this
|
|
83
|
+
if (this.#tokenizer.tokenLineStart() - this.#lastLineNumber > 1) {
|
|
84
|
+
this.#builder.addNewLine(true);
|
|
85
85
|
}
|
|
86
|
-
this
|
|
86
|
+
this.#lastLineNumber = this.#tokenizer.tokenLineEnd();
|
|
87
87
|
if (token) {
|
|
88
|
-
this
|
|
88
|
+
this.#builder.addToken(this.#content.substring(token.start, token.end), this.#fromOffset + token.start);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -96,8 +96,8 @@ export class JavaScriptFormatter {
|
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
let token;
|
|
99
|
-
while ((token = this
|
|
100
|
-
const token = (this
|
|
99
|
+
while ((token = this.#tokenizer.peekToken()) && token.start < node.start) {
|
|
100
|
+
const token = (this.#tokenizer.nextToken() as TokenOrComment);
|
|
101
101
|
// @ts-ignore Same reason as above about Acorn types and ESTree types
|
|
102
102
|
const format = this.formatToken(node.parent, token);
|
|
103
103
|
this.push(token, format);
|
|
@@ -107,8 +107,8 @@ export class JavaScriptFormatter {
|
|
|
107
107
|
|
|
108
108
|
private afterVisit(node: Acorn.ESTree.Node): void {
|
|
109
109
|
let token;
|
|
110
|
-
while ((token = this
|
|
111
|
-
const token = (this
|
|
110
|
+
while ((token = this.#tokenizer.peekToken()) && token.start < node.end) {
|
|
111
|
+
const token = (this.#tokenizer.nextToken() as TokenOrComment);
|
|
112
112
|
const format = this.formatToken(node, token);
|
|
113
113
|
this.push(token, format);
|
|
114
114
|
}
|