Skip to content

Commit

Permalink
Merge branch 'canary' into react-experimental-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
devknoll authored Apr 13, 2021
2 parents e7233da + c3390b8 commit 2173e2b
Show file tree
Hide file tree
Showing 22 changed files with 41 additions and 48 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "10.1.4-canary.6"
"version": "10.1.4-canary.7"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-google-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-google-analytics",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-google-analytics"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-sentry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-sentry",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-sentry"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
6 changes: 2 additions & 4 deletions packages/next/client/dev/amp-dev.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* globals __webpack_hash__ */
import EventSourcePolyfill from './event-source-polyfill'
import { getEventSourceWrapper } from './error-overlay/eventsource'
import { addMessageListener } from './error-overlay/eventsource'
import { setupPing } from './on-demand-entries-utils'
import { displayContent } from './fouc'

Expand Down Expand Up @@ -68,9 +68,7 @@ async function tryApplyUpdates() {
}
}

getEventSourceWrapper({
path: `${assetPrefix}/_next/webpack-hmr`,
}).addMessageListener((event) => {
addMessageListener((event) => {
if (event.data === '\uD83D\uDC93') {
return
}
Expand Down
6 changes: 3 additions & 3 deletions packages/next/client/dev/dev-build-watcher.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getEventSourceWrapper } from './error-overlay/eventsource'
import { addMessageListener } from './error-overlay/eventsource'

export default function initializeBuildWatcher(toggleCallback) {
const shadowHost = document.createElement('div')
Expand Down Expand Up @@ -39,8 +39,8 @@ export default function initializeBuildWatcher(toggleCallback) {
let timeoutId = null

// Handle events
const evtSource = getEventSourceWrapper({ path: '/_next/webpack-hmr' })
evtSource.addMessageListener((event) => {

addMessageListener((event) => {
// This is the heartbeat event
if (event.data === '\uD83D\uDC93') {
return
Expand Down
11 changes: 4 additions & 7 deletions packages/next/client/dev/error-overlay/eventsource.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,10 @@ function EventSourceWrapper(options) {
}
}

export function addMessageListener(cb) {
eventCallbacks.push(cb)
}

export function getEventSourceWrapper(options) {
if (!options.ondemand) {
return {
addMessageListener: (cb) => {
eventCallbacks.push(cb)
},
}
}
return EventSourceWrapper(options)
}
6 changes: 3 additions & 3 deletions packages/next/client/dev/error-overlay/hot-dev-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import * as DevOverlay from '@next/react-dev-overlay/lib/client'
import stripAnsi from 'next/dist/compiled/strip-ansi'
import { getEventSourceWrapper } from './eventsource'
import { addMessageListener } from './eventsource'
import formatWebpackMessages from './format-webpack-messages'

// This alternative WebpackDevServer combines the functionality of:
Expand All @@ -42,10 +42,10 @@ import formatWebpackMessages from './format-webpack-messages'

let hadRuntimeError = false
let customHmrEventHandler
export default function connect(options) {
export default function connect() {
DevOverlay.register()

getEventSourceWrapper(options).addMessageListener((event) => {
addMessageListener((event) => {
// This is the heartbeat event
if (event.data === '\uD83D\uDC93') {
return
Expand Down
6 changes: 4 additions & 2 deletions packages/next/client/dev/on-demand-entries-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ export function setupPing(assetPrefix, pathnameFn, retry) {
// close current EventSource connection
closePing()

const url = `${assetPrefix}/_next/webpack-hmr?page=${currentPage}`
evtSource = getEventSourceWrapper({ path: url, timeout: 5000, ondemand: 1 })
evtSource = getEventSourceWrapper({
path: `${assetPrefix}/_next/webpack-hmr?page=${currentPage}`,
timeout: 5000,
})

evtSource.addMessageListener((event) => {
if (event.data.indexOf('{') === -1) return
Expand Down
8 changes: 2 additions & 6 deletions packages/next/client/dev/webpack-hot-middleware-client.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import connect from './error-overlay/hot-dev-client'

export default ({ assetPrefix }) => {
const options = {
path: `${assetPrefix}/_next/webpack-hmr`,
}

const devClient = connect(options)
export default () => {
const devClient = connect()

devClient.subscribeToHmrEvent((obj) => {
if (obj.action === 'reloadPage') {
Expand Down
6 changes: 3 additions & 3 deletions packages/next/client/next-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import initOnDemandEntries from './dev/on-demand-entries-client'
import initWebpackHMR from './dev/webpack-hot-middleware-client'
import initializeBuildWatcher from './dev/dev-build-watcher'
import { displayContent } from './dev/fouc'
import { getEventSourceWrapper } from './dev/error-overlay/eventsource'
import { addMessageListener } from './dev/error-overlay/eventsource'
import * as querystring from '../next-server/lib/router/utils/querystring'

// Temporary workaround for the issue described here:
Expand All @@ -25,7 +25,7 @@ const {
} = window

const prefix = assetPrefix || ''
const webpackHMR = initWebpackHMR({ assetPrefix: prefix })
const webpackHMR = initWebpackHMR()

window.next = next
initNext({ webpackHMR })
Expand Down Expand Up @@ -72,7 +72,7 @@ initNext({ webpackHMR })
}
}
devPagesManifestListener.unfiltered = true
getEventSourceWrapper({}).addMessageListener(devPagesManifestListener)
addMessageListener(devPagesManifestListener)

if (process.env.__NEXT_BUILD_INDICATOR) {
initializeBuildWatcher((handler) => {
Expand Down
12 changes: 6 additions & 6 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -62,10 +62,10 @@
"dependencies": {
"@babel/runtime": "7.12.5",
"@hapi/accept": "5.0.1",
"@next/env": "10.1.4-canary.6",
"@next/polyfill-module": "10.1.4-canary.6",
"@next/react-dev-overlay": "10.1.4-canary.6",
"@next/react-refresh-utils": "10.1.4-canary.6",
"@next/env": "10.1.4-canary.7",
"@next/polyfill-module": "10.1.4-canary.7",
"@next/react-dev-overlay": "10.1.4-canary.7",
"@next/react-refresh-utils": "10.1.4-canary.7",
"@opentelemetry/api": "0.14.0",
"assert": "2.0.0",
"ast-types": "0.13.2",
Expand Down Expand Up @@ -148,7 +148,7 @@
"@babel/preset-typescript": "7.12.7",
"@babel/traverse": "^7.12.10",
"@babel/types": "7.12.12",
"@next/polyfill-nomodule": "10.1.4-canary.6",
"@next/polyfill-nomodule": "10.1.4-canary.7",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
"@taskr/watch": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "10.1.4-canary.6",
"version": "10.1.4-canary.7",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down

0 comments on commit 2173e2b

Please sign in to comment.