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
package/generate.ts
ADDED
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
import { parse } from '@typescript-eslint/typescript-estree';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Script to copy files and directories from chrome-devtools-frontend dependency
|
|
9
|
+
* into a local lib/ directory for easier development and customization.
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* - Automatic dependency resolution
|
|
13
|
+
* - Transitive dependency copying
|
|
14
|
+
* - Handles both .ts and .js imports
|
|
15
|
+
* - Supports barrel exports (index files)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const SOURCE_BASE = path.join(
|
|
19
|
+
__dirname,
|
|
20
|
+
'node_modules',
|
|
21
|
+
'chrome-devtools-frontend'
|
|
22
|
+
);
|
|
23
|
+
const TARGET_BASE = path.join(__dirname, 'lib');
|
|
24
|
+
|
|
25
|
+
interface CopyItem {
|
|
26
|
+
source: string;
|
|
27
|
+
target?: string; // Optional custom target path, defaults to same relative path
|
|
28
|
+
resolveDependencies?: boolean; // Whether to automatically resolve and copy dependencies
|
|
29
|
+
exportFilter?: string[]; // Optional: only trace dependencies for these specific exports
|
|
30
|
+
excludeCategories?: string[]; // Optional: exclude dependencies matching these path patterns
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// List of files and directories to copy
|
|
34
|
+
const COPY_LIST: CopyItem[] = [
|
|
35
|
+
{
|
|
36
|
+
// source: 'front_end/panels/timeline/TimelineUIUtils.ts',
|
|
37
|
+
source: 'front_end/models/trace/trace.ts',
|
|
38
|
+
resolveDependencies: true,
|
|
39
|
+
// Optional: specify which exports to trace (if not specified, traces all)
|
|
40
|
+
// exportFilter: [
|
|
41
|
+
// 'eventTitle',
|
|
42
|
+
// 'eventColor',
|
|
43
|
+
// 'eventStyle',
|
|
44
|
+
// 'buildTraceEventDetails',
|
|
45
|
+
// // Add only the functions you actually need
|
|
46
|
+
// ],
|
|
47
|
+
// Optional: exclude certain dependency categories
|
|
48
|
+
excludeCategories: [
|
|
49
|
+
// Conservative exclusions - only exclude what we're sure is not needed
|
|
50
|
+
'models/emulation', // Device emulation
|
|
51
|
+
'models/persistence', // File system features
|
|
52
|
+
'models/ai_assistance', // AI features
|
|
53
|
+
'models/live-metrics', // Live metrics
|
|
54
|
+
'models/crux-manager', // CrUX data
|
|
55
|
+
|
|
56
|
+
// Panel exclusions - exclude other panels (this is safe)
|
|
57
|
+
'panels/(?!timeline)', // All panels except timeline
|
|
58
|
+
|
|
59
|
+
// UI exclusions - exclude most UI components but keep essentials
|
|
60
|
+
'ui/legacy/(?!components/linkifier|theme_support|utils|perf_ui)', // Keep essential components
|
|
61
|
+
'ui/components/(?!code_highlighter)', // Keep only code highlighter
|
|
62
|
+
|
|
63
|
+
// Third-party exclusions - only clearly unused libraries
|
|
64
|
+
// 'third_party/marked', // Markdown rendering
|
|
65
|
+
// 'third_party/web-vitals', // Web vitals metrics
|
|
66
|
+
// 'third_party/acorn', // JavaScript parser
|
|
67
|
+
// 'third_party/lighthouse', // Lighthouse integration
|
|
68
|
+
'third_party/(?!i18n|intl-messageformat|legacy-javascript|third-party-web)',
|
|
69
|
+
|
|
70
|
+
// Note: This is more aggressive - excluding all UI components
|
|
71
|
+
// May need to add back specific UI components if errors occur
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
// Track processed files to avoid infinite loops and duplicates
|
|
77
|
+
const processedFiles = new Set<string>();
|
|
78
|
+
const dependencyQueue: string[] = [];
|
|
79
|
+
const cssStubsGenerated = new Set<string>();
|
|
80
|
+
const generatedFileStubsGenerated = new Set<string>();
|
|
81
|
+
const thirdPartyDirsCopied = new Set<string>();
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Resolves import path to actual file path, handling .js/.ts extensions and barrel exports
|
|
85
|
+
*/
|
|
86
|
+
function resolveImportPath(
|
|
87
|
+
importPath: string,
|
|
88
|
+
fromFile: string
|
|
89
|
+
): string | null {
|
|
90
|
+
const fromDir = path.dirname(fromFile);
|
|
91
|
+
let resolvedPath = path.resolve(path.join(SOURCE_BASE, fromDir), importPath);
|
|
92
|
+
|
|
93
|
+
// Make path relative to SOURCE_BASE
|
|
94
|
+
resolvedPath = path.relative(SOURCE_BASE, resolvedPath);
|
|
95
|
+
|
|
96
|
+
// Handle CSS imports by generating stubs
|
|
97
|
+
if (isCssImport(importPath)) {
|
|
98
|
+
generateCssStub(resolvedPath);
|
|
99
|
+
return resolvedPath; // Return the path so it's tracked as processed
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Handle generated file imports by generating stubs
|
|
103
|
+
if (isGeneratedFileImport(importPath)) {
|
|
104
|
+
generateGeneratedFileStub(resolvedPath);
|
|
105
|
+
return resolvedPath; // Return the path so it's tracked as processed
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Try different extensions and patterns
|
|
109
|
+
const candidates = [
|
|
110
|
+
resolvedPath,
|
|
111
|
+
resolvedPath.replace(/\.js$/, '.ts'),
|
|
112
|
+
resolvedPath.replace(/\.js$/, '.d.ts'),
|
|
113
|
+
resolvedPath + '.ts',
|
|
114
|
+
resolvedPath + '.d.ts',
|
|
115
|
+
resolvedPath + '.js',
|
|
116
|
+
path.join(resolvedPath, 'index.ts'),
|
|
117
|
+
path.join(resolvedPath, 'index.d.ts'),
|
|
118
|
+
path.join(resolvedPath, resolvedPath.split('/').pop() + '.ts'), // barrel export pattern
|
|
119
|
+
path.join(resolvedPath, resolvedPath.split('/').pop() + '.d.ts'), // barrel export pattern for .d.ts
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
for (const candidate of candidates) {
|
|
123
|
+
const fullPath = path.join(SOURCE_BASE, candidate);
|
|
124
|
+
if (fs.existsSync(fullPath) && fs.statSync(fullPath).isFile()) {
|
|
125
|
+
return candidate;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Extracts import and export statements from a TypeScript file using AST parsing
|
|
134
|
+
*/
|
|
135
|
+
function extractImports(filePath: string): string[] {
|
|
136
|
+
const fullPath = path.join(SOURCE_BASE, filePath);
|
|
137
|
+
if (!fs.existsSync(fullPath)) {
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
142
|
+
const imports: string[] = [];
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
// Parse the TypeScript file into an AST
|
|
146
|
+
const ast = parse(content, {
|
|
147
|
+
loc: true,
|
|
148
|
+
range: true,
|
|
149
|
+
comment: false,
|
|
150
|
+
tokens: false,
|
|
151
|
+
errorOnUnknownASTType: false,
|
|
152
|
+
errorOnTypeScriptSyntacticAndSemanticIssues: false,
|
|
153
|
+
jsx: false,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// Walk the AST to find import and export declarations
|
|
157
|
+
function walkNode(node: any): void {
|
|
158
|
+
if (!node || typeof node !== 'object') {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Handle ImportDeclaration nodes
|
|
163
|
+
if (node.type === 'ImportDeclaration' && node.source?.value) {
|
|
164
|
+
const importPath = node.source.value;
|
|
165
|
+
// Only process relative imports (not node_modules)
|
|
166
|
+
if (importPath.startsWith('./') || importPath.startsWith('../')) {
|
|
167
|
+
imports.push(importPath);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Handle ExportNamedDeclaration and ExportAllDeclaration nodes
|
|
172
|
+
if (
|
|
173
|
+
(node.type === 'ExportNamedDeclaration' ||
|
|
174
|
+
node.type === 'ExportAllDeclaration') &&
|
|
175
|
+
node.source?.value
|
|
176
|
+
) {
|
|
177
|
+
const importPath = node.source.value;
|
|
178
|
+
// Only process relative imports (not node_modules)
|
|
179
|
+
if (importPath.startsWith('./') || importPath.startsWith('../')) {
|
|
180
|
+
imports.push(importPath);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Handle dynamic imports: import('path')
|
|
185
|
+
if (
|
|
186
|
+
node.type === 'CallExpression' &&
|
|
187
|
+
node.callee?.type === 'Import' &&
|
|
188
|
+
node.arguments?.[0]?.type === 'Literal'
|
|
189
|
+
) {
|
|
190
|
+
const importPath = node.arguments[0].value;
|
|
191
|
+
if (
|
|
192
|
+
typeof importPath === 'string' &&
|
|
193
|
+
(importPath.startsWith('./') || importPath.startsWith('../'))
|
|
194
|
+
) {
|
|
195
|
+
imports.push(importPath);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Recursively walk child nodes
|
|
200
|
+
for (const key in node) {
|
|
201
|
+
if (key === 'parent') continue; // Avoid circular references
|
|
202
|
+
const child = node[key];
|
|
203
|
+
if (Array.isArray(child)) {
|
|
204
|
+
child.forEach(walkNode);
|
|
205
|
+
} else if (child && typeof child === 'object') {
|
|
206
|
+
walkNode(child);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
walkNode(ast);
|
|
212
|
+
} catch (error) {
|
|
213
|
+
console.warn(
|
|
214
|
+
`Failed to parse ${filePath} with AST, falling back to regex:`,
|
|
215
|
+
error.message
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
// Fallback to regex for files that can't be parsed
|
|
219
|
+
const importRegexes = [
|
|
220
|
+
/import\s+.*?\s+from\s+['"`]([^'"`]+)['"`]/gs,
|
|
221
|
+
/import\s+['"`]([^'"`]+)['"`]/g,
|
|
222
|
+
/import\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g,
|
|
223
|
+
];
|
|
224
|
+
|
|
225
|
+
for (const regex of importRegexes) {
|
|
226
|
+
let match;
|
|
227
|
+
while ((match = regex.exec(content)) !== null) {
|
|
228
|
+
const importPath = match[1];
|
|
229
|
+
if (importPath.startsWith('./') || importPath.startsWith('../')) {
|
|
230
|
+
imports.push(importPath);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return [...new Set(imports)]; // Remove duplicates
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Recursively finds all dependencies of a file
|
|
241
|
+
*/
|
|
242
|
+
function findDependencies(
|
|
243
|
+
filePath: string,
|
|
244
|
+
visited = new Set<string>(),
|
|
245
|
+
excludeCategories: string[] = []
|
|
246
|
+
): string[] {
|
|
247
|
+
if (visited.has(filePath)) {
|
|
248
|
+
return [];
|
|
249
|
+
}
|
|
250
|
+
visited.add(filePath);
|
|
251
|
+
|
|
252
|
+
const dependencies: string[] = [];
|
|
253
|
+
const imports = extractImports(filePath);
|
|
254
|
+
|
|
255
|
+
for (const importPath of imports) {
|
|
256
|
+
const resolvedPath = resolveImportPath(importPath, filePath);
|
|
257
|
+
if (resolvedPath && !visited.has(resolvedPath)) {
|
|
258
|
+
// Check if this dependency should be excluded
|
|
259
|
+
if (shouldExcludeDependency(resolvedPath, excludeCategories)) {
|
|
260
|
+
console.log(
|
|
261
|
+
`Excluding dependency: ${resolvedPath} (matches exclusion pattern)`
|
|
262
|
+
);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
dependencies.push(resolvedPath);
|
|
267
|
+
// Recursively find dependencies of this dependency
|
|
268
|
+
dependencies.push(
|
|
269
|
+
...findDependencies(resolvedPath, visited, excludeCategories)
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return dependencies;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Checks if a dependency should be excluded based on category patterns
|
|
279
|
+
*/
|
|
280
|
+
function shouldExcludeDependency(
|
|
281
|
+
filePath: string,
|
|
282
|
+
excludeCategories: string[]
|
|
283
|
+
): boolean {
|
|
284
|
+
if (!excludeCategories.length) {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return excludeCategories.some((category) => {
|
|
289
|
+
// Convert category pattern to a more flexible match
|
|
290
|
+
const pattern = category.replace(/\*/g, '.*');
|
|
291
|
+
const regex = new RegExp(pattern);
|
|
292
|
+
return regex.test(filePath);
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Checks if an import path is a CSS file that should be stubbed
|
|
298
|
+
*/
|
|
299
|
+
function isCssImport(importPath: string): boolean {
|
|
300
|
+
return importPath.endsWith('.css.js') || importPath.endsWith('.css');
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Checks if an import path is a generated file that should be stubbed
|
|
305
|
+
*/
|
|
306
|
+
function isGeneratedFileImport(importPath: string): boolean {
|
|
307
|
+
// Handle specific generated files
|
|
308
|
+
return importPath.endsWith('/locales.js') || importPath === './locales.js';
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Checks if a file path is part of a third-party library that needs its entire directory copied
|
|
313
|
+
*/
|
|
314
|
+
function isThirdPartyDirectory(filePath: string): boolean {
|
|
315
|
+
// Third-party libraries that need their entire directory structure
|
|
316
|
+
return (
|
|
317
|
+
filePath.includes('/third_party/codemirror.next/') ||
|
|
318
|
+
filePath.includes('/third_party/marked/') ||
|
|
319
|
+
filePath.includes('/third_party/acorn/') ||
|
|
320
|
+
filePath.includes('/third_party/')
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Generates a stub file for CSS imports
|
|
326
|
+
*/
|
|
327
|
+
function generateCssStub(cssPath: string): void {
|
|
328
|
+
if (cssStubsGenerated.has(cssPath)) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
cssStubsGenerated.add(cssPath);
|
|
333
|
+
|
|
334
|
+
const fullPath = path.join(TARGET_BASE, cssPath);
|
|
335
|
+
const targetDir = path.dirname(fullPath);
|
|
336
|
+
ensureDir(targetDir);
|
|
337
|
+
|
|
338
|
+
// Generate a simple CSS stub that exports an empty CSSStyleSheet
|
|
339
|
+
const stubContent = `// Auto-generated CSS stub for ${path.basename(cssPath)}
|
|
340
|
+
// This file replaces the original CSS-in-JS file for standalone usage
|
|
341
|
+
|
|
342
|
+
export default {};
|
|
343
|
+
`;
|
|
344
|
+
|
|
345
|
+
fs.writeFileSync(fullPath, stubContent);
|
|
346
|
+
console.log(`Generated CSS stub: ${cssPath}`);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Generates a stub file for generated files like locales.js
|
|
351
|
+
*/
|
|
352
|
+
function generateGeneratedFileStub(filePath: string): void {
|
|
353
|
+
if (generatedFileStubsGenerated.has(filePath)) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
generatedFileStubsGenerated.add(filePath);
|
|
358
|
+
|
|
359
|
+
const fullPath = path.join(TARGET_BASE, filePath);
|
|
360
|
+
const targetDir = path.dirname(fullPath);
|
|
361
|
+
ensureDir(targetDir);
|
|
362
|
+
|
|
363
|
+
let stubContent = '';
|
|
364
|
+
|
|
365
|
+
// Handle specific generated files
|
|
366
|
+
if (filePath.endsWith('/locales.js') || filePath === './locales.js') {
|
|
367
|
+
stubContent = `// Auto-generated stub for locales.js
|
|
368
|
+
// This file replaces the original generated locales file for standalone usage
|
|
369
|
+
|
|
370
|
+
/** The list of all supported locales of DevTools */
|
|
371
|
+
export const LOCALES = ['en-US'];
|
|
372
|
+
|
|
373
|
+
/** A subset of LOCALES that are bundled with Chromium. The rest is fetched remotely */
|
|
374
|
+
export const BUNDLED_LOCALES = ['en-US'];
|
|
375
|
+
|
|
376
|
+
export const DEFAULT_LOCALE = 'en-US';
|
|
377
|
+
|
|
378
|
+
export const REMOTE_FETCH_PATTERN = 'https://devtools://devtools/@VERSION@/locales/@LOCALE@.json';
|
|
379
|
+
|
|
380
|
+
export const LOCAL_FETCH_PATTERN = './locales/@LOCALE@.json';
|
|
381
|
+
`;
|
|
382
|
+
} else {
|
|
383
|
+
// Generic stub for other generated files
|
|
384
|
+
stubContent = `// Auto-generated stub for ${path.basename(filePath)}
|
|
385
|
+
// This file replaces the original generated file for standalone usage
|
|
386
|
+
|
|
387
|
+
export default {};
|
|
388
|
+
`;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
fs.writeFileSync(fullPath, stubContent);
|
|
392
|
+
console.log(`Generated generated file stub: ${filePath}`);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Copies an entire third-party directory to preserve its structure
|
|
397
|
+
*/
|
|
398
|
+
function copyThirdPartyDirectory(filePath: string): void {
|
|
399
|
+
// Extract the third-party directory path (e.g., front_end/third_party/codemirror.next)
|
|
400
|
+
const thirdPartyMatch = filePath.match(/(.*\/third_party\/[^/]+)/);
|
|
401
|
+
if (!thirdPartyMatch) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
const thirdPartyDir = thirdPartyMatch[1];
|
|
406
|
+
|
|
407
|
+
if (thirdPartyDirsCopied.has(thirdPartyDir)) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
thirdPartyDirsCopied.add(thirdPartyDir);
|
|
412
|
+
|
|
413
|
+
const sourcePath = path.join(SOURCE_BASE, thirdPartyDir);
|
|
414
|
+
const targetPath = path.join(TARGET_BASE, thirdPartyDir);
|
|
415
|
+
|
|
416
|
+
if (!fs.existsSync(sourcePath)) {
|
|
417
|
+
console.warn(`Third-party directory not found: ${sourcePath}`);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
console.log(`Copying entire third-party directory: ${thirdPartyDir}`);
|
|
422
|
+
copyDirectory(sourcePath, targetPath);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Ensures a directory exists, creating it recursively if needed
|
|
427
|
+
*/
|
|
428
|
+
function ensureDir(dirPath: string): void {
|
|
429
|
+
if (!fs.existsSync(dirPath)) {
|
|
430
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
431
|
+
console.log(`Created directory: ${dirPath}`);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Copies a file from source to target, creating directories as needed
|
|
437
|
+
*/
|
|
438
|
+
function copyFile(sourcePath: string, targetPath: string): void {
|
|
439
|
+
const targetDir = path.dirname(targetPath);
|
|
440
|
+
ensureDir(targetDir);
|
|
441
|
+
|
|
442
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
443
|
+
console.log(`Copied: ${sourcePath} -> ${targetPath}`);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Recursively copies a directory and all its contents
|
|
448
|
+
*/
|
|
449
|
+
function copyDirectory(sourcePath: string, targetPath: string): void {
|
|
450
|
+
ensureDir(targetPath);
|
|
451
|
+
|
|
452
|
+
const items = fs.readdirSync(sourcePath);
|
|
453
|
+
|
|
454
|
+
for (const item of items) {
|
|
455
|
+
const sourceItemPath = path.join(sourcePath, item);
|
|
456
|
+
const targetItemPath = path.join(targetPath, item);
|
|
457
|
+
|
|
458
|
+
const stat = fs.statSync(sourceItemPath);
|
|
459
|
+
|
|
460
|
+
if (stat.isDirectory()) {
|
|
461
|
+
copyDirectory(sourceItemPath, targetItemPath);
|
|
462
|
+
} else {
|
|
463
|
+
copyFile(sourceItemPath, targetItemPath);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Copies a single file if not already processed
|
|
470
|
+
*/
|
|
471
|
+
function copyFileIfNeeded(filePath: string): void {
|
|
472
|
+
if (processedFiles.has(filePath)) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
processedFiles.add(filePath);
|
|
477
|
+
|
|
478
|
+
// Check if this is part of a third-party directory that needs full copying
|
|
479
|
+
if (isThirdPartyDirectory(filePath)) {
|
|
480
|
+
copyThirdPartyDirectory(filePath);
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const sourcePath = path.join(SOURCE_BASE, filePath);
|
|
485
|
+
const targetPath = path.join(TARGET_BASE, filePath);
|
|
486
|
+
|
|
487
|
+
if (!fs.existsSync(sourcePath)) {
|
|
488
|
+
console.warn(`Dependency not found: ${sourcePath}`);
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
console.log(`Copying dependency: ${filePath}`);
|
|
493
|
+
copyFile(sourcePath, targetPath);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Processes a single copy item from the COPY_LIST
|
|
498
|
+
*/
|
|
499
|
+
function processCopyItem(item: CopyItem): void {
|
|
500
|
+
const sourcePath = path.join(SOURCE_BASE, item.source);
|
|
501
|
+
const targetRelativePath = item.target || item.source;
|
|
502
|
+
const targetPath = path.join(TARGET_BASE, targetRelativePath);
|
|
503
|
+
|
|
504
|
+
if (!fs.existsSync(sourcePath)) {
|
|
505
|
+
console.error(`Source not found: ${sourcePath}`);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
const stat = fs.statSync(sourcePath);
|
|
510
|
+
|
|
511
|
+
if (stat.isDirectory()) {
|
|
512
|
+
console.log(`Copying directory: ${item.source}`);
|
|
513
|
+
copyDirectory(sourcePath, targetPath);
|
|
514
|
+
} else {
|
|
515
|
+
console.log(`Copying file: ${item.source}`);
|
|
516
|
+
copyFile(sourcePath, targetPath);
|
|
517
|
+
processedFiles.add(item.source);
|
|
518
|
+
|
|
519
|
+
// Resolve and copy dependencies if requested
|
|
520
|
+
if (item.resolveDependencies) {
|
|
521
|
+
console.log(`Resolving dependencies for: ${item.source}`);
|
|
522
|
+
const dependencies = findDependencies(
|
|
523
|
+
item.source,
|
|
524
|
+
new Set(),
|
|
525
|
+
item.excludeCategories || []
|
|
526
|
+
);
|
|
527
|
+
|
|
528
|
+
if (item.excludeCategories?.length) {
|
|
529
|
+
console.log(
|
|
530
|
+
`Excluding categories: ${item.excludeCategories.join(', ')}`
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
console.log(`Found ${dependencies.length} dependencies`);
|
|
535
|
+
for (const dep of dependencies) {
|
|
536
|
+
copyFileIfNeeded(dep);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Main function to process all copy items
|
|
544
|
+
*/
|
|
545
|
+
function main(): void {
|
|
546
|
+
console.log(
|
|
547
|
+
'Starting copy process with dependency resolution and stubbing...'
|
|
548
|
+
);
|
|
549
|
+
console.log(`Source base: ${SOURCE_BASE}`);
|
|
550
|
+
console.log(`Target base: ${TARGET_BASE}`);
|
|
551
|
+
console.log('');
|
|
552
|
+
|
|
553
|
+
// Clear processed files for fresh run
|
|
554
|
+
processedFiles.clear();
|
|
555
|
+
cssStubsGenerated.clear();
|
|
556
|
+
generatedFileStubsGenerated.clear();
|
|
557
|
+
thirdPartyDirsCopied.clear();
|
|
558
|
+
|
|
559
|
+
// Ensure target base directory exists
|
|
560
|
+
ensureDir(TARGET_BASE);
|
|
561
|
+
|
|
562
|
+
// Process each copy item
|
|
563
|
+
for (const item of COPY_LIST) {
|
|
564
|
+
try {
|
|
565
|
+
console.log(`\n--- Processing: ${item.source} ---`);
|
|
566
|
+
processCopyItem(item);
|
|
567
|
+
} catch (error) {
|
|
568
|
+
console.error(`Error processing ${item.source}:`, error);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
console.log('');
|
|
573
|
+
console.log(`Copy process completed!`);
|
|
574
|
+
console.log(`- Processed ${processedFiles.size} files total`);
|
|
575
|
+
console.log(`- Generated ${cssStubsGenerated.size} CSS stubs`);
|
|
576
|
+
console.log(
|
|
577
|
+
`- Generated ${generatedFileStubsGenerated.size} generated file stubs`
|
|
578
|
+
);
|
|
579
|
+
console.log(`- Copied ${thirdPartyDirsCopied.size} third-party directories`);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// Run the script if called directly
|
|
583
|
+
if (require.main === module) {
|
|
584
|
+
main();
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Analyzes dependencies without copying them - useful for understanding what would be included
|
|
589
|
+
*/
|
|
590
|
+
function analyzeDependencies(
|
|
591
|
+
filePath: string,
|
|
592
|
+
excludeCategories: string[] = []
|
|
593
|
+
): {
|
|
594
|
+
total: number;
|
|
595
|
+
byCategory: Record<string, number>;
|
|
596
|
+
excluded: string[];
|
|
597
|
+
included: string[];
|
|
598
|
+
} {
|
|
599
|
+
const dependencies = findDependencies(filePath, new Set(), excludeCategories);
|
|
600
|
+
const excluded: string[] = [];
|
|
601
|
+
const included: string[] = [];
|
|
602
|
+
const byCategory: Record<string, number> = {};
|
|
603
|
+
|
|
604
|
+
// Analyze all possible dependencies (without exclusions)
|
|
605
|
+
const allDependencies = findDependencies(filePath, new Set(), []);
|
|
606
|
+
|
|
607
|
+
for (const dep of allDependencies) {
|
|
608
|
+
if (shouldExcludeDependency(dep, excludeCategories)) {
|
|
609
|
+
excluded.push(dep);
|
|
610
|
+
} else {
|
|
611
|
+
included.push(dep);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// Categorize by path
|
|
615
|
+
const parts = dep.split('/');
|
|
616
|
+
const category = parts.slice(0, 2).join('/'); // e.g., "ui/legacy", "models/trace"
|
|
617
|
+
byCategory[category] = (byCategory[category] || 0) + 1;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
return {
|
|
621
|
+
total: allDependencies.length,
|
|
622
|
+
byCategory,
|
|
623
|
+
excluded,
|
|
624
|
+
included,
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
export {
|
|
629
|
+
main,
|
|
630
|
+
COPY_LIST,
|
|
631
|
+
processCopyItem,
|
|
632
|
+
findDependencies,
|
|
633
|
+
resolveImportPath,
|
|
634
|
+
extractImports,
|
|
635
|
+
generateCssStub,
|
|
636
|
+
isCssImport,
|
|
637
|
+
generateGeneratedFileStub,
|
|
638
|
+
isGeneratedFileImport,
|
|
639
|
+
copyThirdPartyDirectory,
|
|
640
|
+
isThirdPartyDirectory,
|
|
641
|
+
analyzeDependencies,
|
|
642
|
+
shouldExcludeDependency,
|
|
643
|
+
};
|
package/index.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DevToolsLocale } from './lib/front_end/core/i18n/DevToolsLocale';
|
|
2
|
+
import { registerLocaleDataForTest } from './lib/front_end/core/i18n/i18nImpl';
|
|
3
|
+
|
|
4
|
+
export function initDevToolsTracing() {
|
|
5
|
+
registerLocaleDataForTest('en-US', {});
|
|
6
|
+
|
|
7
|
+
const identity = (locale: string) => locale;
|
|
8
|
+
const data = {
|
|
9
|
+
settingLanguage: 'en-US',
|
|
10
|
+
navigatorLanguage: '',
|
|
11
|
+
lookupClosestDevToolsLocale: identity,
|
|
12
|
+
};
|
|
13
|
+
DevToolsLocale.instance({ create: true, data });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export * as trace from './lib/front_end/models/trace/trace';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 2019 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 Root from '../root/root.js';
|
|
6
|
+
|
|
7
|
+
import type {App} from './App.js';
|
|
8
|
+
|
|
9
|
+
export interface AppProvider {
|
|
10
|
+
createApp(): App;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const registeredAppProvider: AppProviderRegistration[] = [];
|
|
14
|
+
|
|
15
|
+
export function registerAppProvider(registration: AppProviderRegistration): void {
|
|
16
|
+
registeredAppProvider.push(registration);
|
|
17
|
+
}
|
|
18
|
+
export function getRegisteredAppProviders(): AppProviderRegistration[] {
|
|
19
|
+
return registeredAppProvider
|
|
20
|
+
.filter(
|
|
21
|
+
provider => Root.Runtime.Runtime.isDescriptorEnabled({experiment: undefined, condition: provider.condition}))
|
|
22
|
+
.sort((firstProvider, secondProvider) => {
|
|
23
|
+
const order1 = firstProvider.order || 0;
|
|
24
|
+
const order2 = secondProvider.order || 0;
|
|
25
|
+
return order1 - order2;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export interface AppProviderRegistration {
|
|
29
|
+
loadAppProvider: () => Promise<AppProvider>;
|
|
30
|
+
condition?: Root.Runtime.Condition;
|
|
31
|
+
order: number;
|
|
32
|
+
}
|