Unverified Commit 85b00b2c authored by Keen Yee Liau's avatar Keen Yee Liau Committed by GitHub

Collect telemetry for next/future/image (#39046)

* test: cleanup telemetry integration test

Instead of constantly parsing the console output, parse the output
once, convert the entries in JavaScript objects, then compare them
logically rather than textually.

* Collect telemetry for next/future/image

Track adoption of next/future/image and add relevant test.
parent ec2f0a8c
...@@ -23,6 +23,7 @@ export type SWC_TARGET_TRIPLE = ...@@ -23,6 +23,7 @@ export type SWC_TARGET_TRIPLE =
export type Feature = export type Feature =
| 'next/image' | 'next/image'
| 'next/future/image'
| 'next/script' | 'next/script'
| 'next/dynamic' | 'next/dynamic'
| 'swcLoader' | 'swcLoader'
...@@ -59,6 +60,7 @@ interface Connection { ...@@ -59,6 +60,7 @@ interface Connection {
// Map of a feature module to the file it belongs in the next package. // Map of a feature module to the file it belongs in the next package.
const FEATURE_MODULE_MAP: ReadonlyMap<Feature, string> = new Map([ const FEATURE_MODULE_MAP: ReadonlyMap<Feature, string> = new Map([
['next/image', '/next/image.js'], ['next/image', '/next/image.js'],
['next/future/image', '/next/future/image.js'],
['next/script', '/next/script.js'], ['next/script', '/next/script.js'],
['next/dynamic', '/next/dynamic.js'], ['next/dynamic', '/next/dynamic.js'],
]) ])
......
...@@ -132,6 +132,7 @@ export type EventBuildFeatureUsage = { ...@@ -132,6 +132,7 @@ export type EventBuildFeatureUsage = {
// *before* you make changes here. // *before* you make changes here.
featureName: featureName:
| 'next/image' | 'next/image'
| 'next/future/image'
| 'next/script' | 'next/script'
| 'next/dynamic' | 'next/dynamic'
| 'experimental/optimizeCss' | 'experimental/optimizeCss'
......
import Image from 'next/image' import Image from 'next/image'
import { Image as FutureImage } from 'next/future/image'
import profilePic from '../public/small.jpg' import profilePic from '../public/small.jpg'
function About() { function About() {
...@@ -12,3 +13,7 @@ function About() { ...@@ -12,3 +13,7 @@ function About() {
} }
export default About export default About
export function AboutFutureImage() {
return <FutureImage src={profilePic} alt="Picture of the author" />
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment