chromium/third_party/blink/public/mojom/loader/javascript_framework_detection.mojom

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module blink.mojom;

// JS Frameworks (& CMSes) are detected at load time. This helps us correlate
// performance metrics (and other metrics) with the existence and version of
// frameworks on the page.
//
// Do not change the numeric value assignments, or reuse old values. The
// auto speculation rules feature (https://crbug.com/1472970) uses these values
// inside Finch configs.
enum JavaScriptFramework {
  kNuxt = 0,
  kVuePress = 1,
  kSapper = 2,
  kGatsby = 3,
  kNext = 4,
  kAngular = 5,
  kVue = 6,
  kSvelte = 7,
  kPreact = 8,
  kReact = 9,
  kDrupal = 10,
  kJoomla = 11,
  kShopify = 12,
  kSquarespace = 13,
  kWix = 14,
  kWordPress = 15,
};

// This struct is typemapped to blink::JavaScriptFrameworkDetectionResult.
// JS Frameworks are detected in blink at load time, and reported to UKM via
// the PageLoadMetrics mechanism in the browser process.
struct JavaScriptFrameworkDetectionResult {
  // A map containing versions of detected frameworks.
  // Frameworks that are not detected at all would not appear in the map, while
  // frameworks that are detected without a version would have a value of
  // kNoFrameworkVersionDetected, see javascript_framework_detection.h.
  // The version value is in the format of 0xMMmm (M = Major, m = minor).
  // Patch versions etc. are not expressed.
  map<JavaScriptFramework, int16> detected_versions;
};