diff --git a/packages/next/client/index.tsx b/packages/next/client/index.tsx index 3e7264a9663bb..5b258c0aa35e5 100644 --- a/packages/next/client/index.tsx +++ b/packages/next/client/index.tsx @@ -33,8 +33,11 @@ import measureWebVitals from './performance-relayer' import { RouteAnnouncer } from './route-announcer' import { createRouter, makePublicRouterInstance } from './router' import { getProperError } from '../lib/is-error' -import { flushBufferedVitalsMetrics, trackWebVitalMetric } from './vitals' -import { RefreshContext } from './rsc/refresh' +import { + flushBufferedVitalsMetrics, + trackWebVitalMetric, +} from './streaming/vitals' +import { RefreshContext } from './streaming/refresh' /// diff --git a/packages/next/client/rsc/index.ts b/packages/next/client/rsc/index.ts deleted file mode 100644 index 566fab06ab74b..0000000000000 --- a/packages/next/client/rsc/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { useRefreshRoot as unstable_useRefreshRoot } from './refresh' diff --git a/packages/next/client/streaming/index.ts b/packages/next/client/streaming/index.ts new file mode 100644 index 0000000000000..f6fc5aaf42e4b --- /dev/null +++ b/packages/next/client/streaming/index.ts @@ -0,0 +1,2 @@ +export { useRefreshRoot as unstable_useRefreshRoot } from './refresh' +export { useWebVitalsReport as unstable_useWebVitalsReport } from './vitals' diff --git a/packages/next/client/rsc/refresh.ts b/packages/next/client/streaming/refresh.ts similarity index 100% rename from packages/next/client/rsc/refresh.ts rename to packages/next/client/streaming/refresh.ts diff --git a/packages/next/client/vitals.ts b/packages/next/client/streaming/vitals.ts similarity index 95% rename from packages/next/client/vitals.ts rename to packages/next/client/streaming/vitals.ts index 32029868674d5..e239470457a57 100644 --- a/packages/next/client/vitals.ts +++ b/packages/next/client/streaming/vitals.ts @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react' -import { NextWebVitalsMetric } from '../pages/_app' +import { NextWebVitalsMetric } from '../../pages/_app' type ReportWebVitalsCallback = (webVitals: NextWebVitalsMetric) => any export const webVitalsCallbacks = new Set() diff --git a/packages/next/package.json b/packages/next/package.json index 0926f7294762a..5d5da21ee0e67 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -44,10 +44,8 @@ "jest.d.ts", "amp.js", "amp.d.ts", - "vitals.js", - "vitals.d.ts", - "rsc.js", - "rsc.d.ts", + "streaming.js", + "streaming.d.ts", "index.d.ts", "types/index.d.ts", "types/global.d.ts", diff --git a/packages/next/rsc.d.ts b/packages/next/rsc.d.ts deleted file mode 100644 index 1e63004efc5fa..0000000000000 --- a/packages/next/rsc.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/client/rsc' diff --git a/packages/next/rsc.js b/packages/next/rsc.js deleted file mode 100644 index 64641581f242e..0000000000000 --- a/packages/next/rsc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/client/rsc') diff --git a/packages/next/streaming.d.ts b/packages/next/streaming.d.ts new file mode 100644 index 0000000000000..c0cc6709ecb1a --- /dev/null +++ b/packages/next/streaming.d.ts @@ -0,0 +1 @@ +export * from './dist/client/streaming' diff --git a/packages/next/streaming.js b/packages/next/streaming.js new file mode 100644 index 0000000000000..2d8b5c4f47e28 --- /dev/null +++ b/packages/next/streaming.js @@ -0,0 +1 @@ +module.exports = require('./dist/client/streaming') diff --git a/packages/next/vitals.d.ts b/packages/next/vitals.d.ts deleted file mode 100644 index ab967d34ab52e..0000000000000 --- a/packages/next/vitals.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { useWebVitalsReport as unstable_useWebVitalsReport } from './dist/client/vitals' diff --git a/packages/next/vitals.js b/packages/next/vitals.js deleted file mode 100644 index 0cf2911ed439f..0000000000000 --- a/packages/next/vitals.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - unstable_useWebVitalsReport: require('./dist/client/vitals') - .useWebVitalsReport, -} diff --git a/test/integration/relay-analytics-disabled/pages/index.js b/test/integration/relay-analytics-disabled/pages/index.js index b5832179bbd84..d8064b2d5b1ad 100644 --- a/test/integration/relay-analytics-disabled/pages/index.js +++ b/test/integration/relay-analytics-disabled/pages/index.js @@ -1,4 +1,4 @@ -import { getBufferedVitalsMetrics } from 'next/dist/client/vitals' +import { getBufferedVitalsMetrics } from 'next/dist/client/streaming/vitals' if (typeof navigator !== 'undefined') { window.__BEACONS = window.__BEACONS || [] diff --git a/test/integration/relay-analytics/pages/index.js b/test/integration/relay-analytics/pages/index.js index c10829859fd1c..82b506fcc7bca 100644 --- a/test/integration/relay-analytics/pages/index.js +++ b/test/integration/relay-analytics/pages/index.js @@ -1,6 +1,6 @@ /* global localStorage */ -import { unstable_useWebVitalsReport } from 'next/vitals' -import { getBufferedVitalsMetrics } from 'next/dist/client/vitals' +import { unstable_useWebVitalsReport } from 'next/streaming' +import { getBufferedVitalsMetrics } from 'next/dist/client/streaming/vitals' if (typeof navigator !== 'undefined') { window.__BEACONS = window.__BEACONS || []