Skip to content

Commit

Permalink
Group streaming experimental apis (#33878)
Browse files Browse the repository at this point in the history
Move undocumented `next/rsc` and `next/vitals` to `next/streaming`. In the future `next/streaming` can contain streaming SSR related (including react server components) APIs together.
  • Loading branch information
huozhi committed Feb 2, 2022
1 parent 965d26e commit 5365f41
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 18 deletions.
7 changes: 5 additions & 2 deletions packages/next/client/index.tsx
Expand Up @@ -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'

/// <reference types="react-dom/experimental" />

Expand Down
1 change: 0 additions & 1 deletion packages/next/client/rsc/index.ts

This file was deleted.

2 changes: 2 additions & 0 deletions packages/next/client/streaming/index.ts
@@ -0,0 +1,2 @@
export { useRefreshRoot as unstable_useRefreshRoot } from './refresh'
export { useWebVitalsReport as unstable_useWebVitalsReport } from './vitals'
File renamed without changes.
@@ -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<ReportWebVitalsCallback>()
Expand Down
6 changes: 2 additions & 4 deletions packages/next/package.json
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion packages/next/rsc.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/next/rsc.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/next/streaming.d.ts
@@ -0,0 +1 @@
export * from './dist/client/streaming'
1 change: 1 addition & 0 deletions packages/next/streaming.js
@@ -0,0 +1 @@
module.exports = require('./dist/client/streaming')
1 change: 0 additions & 1 deletion packages/next/vitals.d.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/next/vitals.js

This file was deleted.

2 changes: 1 addition & 1 deletion 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 || []
Expand Down
4 changes: 2 additions & 2 deletions 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 || []
Expand Down

0 comments on commit 5365f41

Please sign in to comment.