Skip to content

Commit

Permalink
Merge branch 'canary' into alex-language-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jun 25, 2021
2 parents 34a7057 + 170dc0d commit c9b0b4c
Show file tree
Hide file tree
Showing 21 changed files with 91 additions and 43 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": "11.0.2-canary.0"
"version": "11.0.2-canary.2"
}
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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"description": "ESLint configuration used by NextJS.",
"main": "index.js",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
"directory": "packages/eslint-config-next"
},
"dependencies": {
"@next/eslint-plugin-next": "11.0.2-canary.0",
"@next/eslint-plugin-next": "11.0.2-canary.2",
"@rushstack/eslint-patch": "^1.0.6",
"@typescript-eslint/parser": "^4.20.0",
"eslint-import-resolver-node": "^0.3.4",
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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"main": "index.js",
"license": "MIT",
"repository": {
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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,27 @@ export class FontStylesheetGatheringPlugin {
}

// node.arguments[0] is the name of the tag and [1] are the props.
const propsNode = node.arguments[1] as namedTypes.ObjectExpression
const arg1 = node.arguments[1]

const propsNode =
arg1.type === 'ObjectExpression'
? (arg1 as namedTypes.ObjectExpression)
: undefined
const props: { [key: string]: string } = {}
propsNode.properties.forEach((prop) => {
if (prop.type !== 'Property') {
return
}
if (
prop.key.type === 'Identifier' &&
prop.value.type === 'Literal'
) {
props[prop.key.name] = prop.value.value as string
}
})
if (propsNode) {
propsNode.properties.forEach((prop) => {
if (prop.type !== 'Property') {
return
}
if (
prop.key.type === 'Identifier' &&
prop.value.type === 'Literal'
) {
props[prop.key.name] = prop.value.value as string
}
})
}

if (
!props.rel ||
props.rel !== 'stylesheet' ||
Expand Down
6 changes: 4 additions & 2 deletions packages/next/build/webpack/plugins/profiling-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export class ProfilingPlugin {
this.traceHookPair(
'webpack-invalidated',
compiler.hooks.invalid,
compiler.hooks.done
compiler.hooks.done,
() => ({ name: compiler.name })
)
}
}
Expand All @@ -86,7 +87,8 @@ export class ProfilingPlugin {
this.traceHookPair(
'webpack-compilation',
compiler.hooks.beforeCompile,
compiler.hooks.afterCompile
compiler.hooks.afterCompile,
() => ({ name: compiler.name })
)
}

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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -65,10 +65,10 @@
"dependencies": {
"@babel/runtime": "7.12.5",
"@hapi/accept": "5.0.2",
"@next/env": "11.0.2-canary.0",
"@next/polyfill-module": "11.0.2-canary.0",
"@next/react-dev-overlay": "11.0.2-canary.0",
"@next/react-refresh-utils": "11.0.2-canary.0",
"@next/env": "11.0.2-canary.2",
"@next/polyfill-module": "11.0.2-canary.2",
"@next/react-dev-overlay": "11.0.2-canary.2",
"@next/react-refresh-utils": "11.0.2-canary.2",
"assert": "2.0.0",
"ast-types": "0.13.2",
"browserify-zlib": "0.2.0",
Expand Down Expand Up @@ -152,7 +152,7 @@
"@babel/preset-typescript": "7.12.7",
"@babel/traverse": "^7.12.10",
"@babel/types": "7.12.12",
"@next/polyfill-nomodule": "11.0.2-canary.0",
"@next/polyfill-nomodule": "11.0.2-canary.2",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
"@taskr/watch": "1.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/next/telemetry/trace/report/to-telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { traceGlobals } from '../shared'

const TRACE_EVENT_WHITELIST = new Map(
const TRACE_EVENT_ACCESSLIST = new Map(
Object.entries({
'webpack-invalidated': 'WEBPACK_INVALIDATED',
})
)

const reportToTelemetry = (spanName: string, duration: number) => {
const eventName = TRACE_EVENT_WHITELIST.get(spanName)
const eventName = TRACE_EVENT_ACCESSLIST.get(spanName)
if (!eventName) {
return
}
Expand Down
19 changes: 12 additions & 7 deletions packages/next/telemetry/trace/report/to-zipkin.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { randomBytes } from 'crypto'
import fetch from 'node-fetch'
import * as Log from '../../../build/output/log'

let traceId = process.env.TRACE_ID
if (!traceId) {
traceId = process.env.TRACE_ID = randomBytes(8).toString('hex')
}

const localEndpoint = {
serviceName: 'zipkin-query',
serviceName: 'nextjs',
ipv4: '127.0.0.1',
port: 9411,
}
const zipkinUrl = `http://${localEndpoint.ipv4}:${localEndpoint.port}/api/v2/spans`
const zipkinUrl = `http://${localEndpoint.ipv4}:${localEndpoint.port}`
const zipkinAPI = `${zipkinUrl}/api/v2/spans`

const reportToLocalHost = (
name: string,
Expand All @@ -21,6 +20,12 @@ const reportToLocalHost = (
parentId?: string,
attrs?: Object
) => {
if (!traceId) {
traceId = process.env.TRACE_ID = randomBytes(8).toString('hex')
Log.info(
`Zipkin trace will be available on ${zipkinUrl}/zipkin/traces/${traceId}`
)
}
const body = [
{
traceId,
Expand All @@ -35,11 +40,11 @@ const reportToLocalHost = (
]

// We intentionally do not block on I/O here.
fetch(zipkinUrl, {
fetch(zipkinAPI, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
}).catch(() => {})
}).catch(console.log)
}

export default reportToLocalHost
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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"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": "11.0.2-canary.0",
"version": "11.0.2-canary.2",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Document, { Html, Head, Main, NextScript } from 'next/document'

class MyDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx)
return { ...initialProps }
}

render() {
const things = { className: 'test' }
return (
<Html>
<Head />
<link {...things} />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
}

export default MyDocument
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Home() {
return <h1>Hello</h1>
}
6 changes: 6 additions & 0 deletions test/integration/font-optimization/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,10 @@ describe('Font Optimization', () => {
})
}
)

test('Spread operator regression on <link>', async () => {
const appDir = join(fixturesDir, 'spread-operator-regression')
const { code } = await nextBuild(appDir)
expect(code).toBe(0)
})
})

0 comments on commit c9b0b4c

Please sign in to comment.