Buckets:
| use turbo_rcstr::{RcStr, rcstr}; | |
| use turbo_tasks::{Vc, fxindexmap}; | |
| use turbopack_core::diagnostics::{Diagnostic, DiagnosticPayload}; | |
| /// A structure that keeps track of whether a particular Next.js feature is | |
| /// enabled for the telemetry. | |
| /// | |
| /// The original implementation code can be found | |
| /// [here](https://github.com/vercel/next.js/blob/9da305fe320b89ee2f8c3cfb7ecbf48856368913/packages/next/src/build/webpack-config.ts#L2516). | |
| pub struct NextFeatureTelemetry { | |
| pub event_name: RcStr, | |
| pub feature_name: RcStr, | |
| pub enabled: bool, | |
| } | |
| impl NextFeatureTelemetry { | |
| pub fn new(feature_name: RcStr, enabled: bool) -> Self { | |
| NextFeatureTelemetry { | |
| event_name: rcstr!("EVENT_BUILD_FEATURE_USAGE"), | |
| feature_name, | |
| enabled, | |
| } | |
| } | |
| } | |
| impl Diagnostic for NextFeatureTelemetry { | |
| fn category(&self) -> Vc<RcStr> { | |
| Vc::cell(rcstr!("NextFeatureTelemetry_category_tbd")) | |
| } | |
| fn name(&self) -> Vc<RcStr> { | |
| Vc::cell(self.event_name.clone()) | |
| } | |
| fn payload(&self) -> Vc<DiagnosticPayload> { | |
| Vc::cell(fxindexmap! { | |
| self.feature_name.clone() => | |
| self.enabled.to_string().into(), | |
| }) | |
| } | |
| } | |
| /// A struct represent telemetry event for the feature usage, | |
| /// referred as `importing` a certain module. (i.e importing @next/image) | |
| pub struct ModuleFeatureTelemetry { | |
| pub event_name: RcStr, | |
| pub feature_name: RcStr, | |
| pub invocation_count: usize, | |
| } | |
| impl ModuleFeatureTelemetry { | |
| pub fn new(feature_name: RcStr, invocation_count: usize) -> Self { | |
| ModuleFeatureTelemetry { | |
| event_name: rcstr!("EVENT_BUILD_FEATURE_USAGE"), | |
| feature_name, | |
| invocation_count, | |
| } | |
| } | |
| } | |
| impl Diagnostic for ModuleFeatureTelemetry { | |
| fn category(&self) -> Vc<RcStr> { | |
| Vc::cell(rcstr!("ModuleFeatureTelemetry_category_tbd")) | |
| } | |
| fn name(&self) -> Vc<RcStr> { | |
| Vc::cell(self.event_name.clone()) | |
| } | |
| fn payload(&self) -> Vc<DiagnosticPayload> { | |
| Vc::cell(fxindexmap! { | |
| self.feature_name.clone() => | |
| self.invocation_count.to_string().into(), | |
| }) | |
| } | |
| } | |
Xet Storage Details
- Size:
- 2.47 kB
- Xet hash:
- a62e8ba33be05f5b167110256fa7c03c9ec7b68824817e237c7b6b1f94f7a4a8
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.