telemetry-plugin.d.ts 1.4 KB

1234567891011121314151617181920212223
  1. import { webpack } from 'next/dist/compiled/webpack/webpack';
  2. /**
  3. * List of target triples next-swc native binary supports.
  4. */
  5. export declare type SWC_TARGET_TRIPLE = 'x86_64-apple-darwin' | 'x86_64-unknown-linux-gnu' | 'x86_64-pc-windows-msvc' | 'i686-pc-windows-msvc' | 'aarch64-unknown-linux-gnu' | 'armv7-unknown-linux-gnueabihf' | 'aarch64-apple-darwin' | 'aarch64-linux-android' | 'arm-linux-androideabi' | 'x86_64-unknown-freebsd' | 'x86_64-unknown-linux-musl' | 'aarch64-unknown-linux-musl' | 'aarch64-pc-windows-msvc';
  6. export declare type Feature = 'next/image' | 'next/future/image' | 'next/script' | 'next/dynamic' | 'swcLoader' | 'swcMinify' | 'swcRelay' | 'swcStyledComponents' | 'swcReactRemoveProperties' | 'swcExperimentalDecorators' | 'swcRemoveConsole' | 'swcImportSource' | 'swcEmotion' | `swc/target/${SWC_TARGET_TRIPLE}`;
  7. interface FeatureUsage {
  8. featureName: Feature;
  9. invocationCount: number;
  10. }
  11. /**
  12. * Plugin that queries the ModuleGraph to look for modules that correspond to
  13. * certain features (e.g. next/image and next/script) and record how many times
  14. * they are imported.
  15. */
  16. export declare class TelemetryPlugin implements webpack.WebpackPluginInstance {
  17. private usageTracker;
  18. constructor(buildFeaturesMap: Map<Feature, boolean>);
  19. apply(compiler: webpack.Compiler): void;
  20. usages(): FeatureUsage[];
  21. packagesUsedInServerSideProps(): string[];
  22. }
  23. export {};