Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'i18n/stabilize-test' of github.com:ijjk/next.js into i1…
…8n/stabilize-test
- Loading branch information
Showing
25 changed files
with
246 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,5 @@ | |
"registry": "https://registry.npmjs.org/" | ||
} | ||
}, | ||
"version": "9.5.6-canary.3" | ||
"version": "9.5.6-canary.4" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@next/env", | ||
"version": "9.5.6-canary.3", | ||
"version": "9.5.6-canary.4", | ||
"keywords": [ | ||
"react", | ||
"next", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* global localStorage */ | ||
/* eslint-disable camelcase */ | ||
import App from 'next/app' | ||
|
||
export default class MyApp extends App {} | ||
|
||
/* | ||
Method is experimental and will eventually be handled in a Next.js plugin | ||
*/ | ||
export function reportWebVitals(data) { | ||
localStorage.setItem( | ||
data.name || data.entryType, | ||
data.value !== undefined ? data.value : data.startTime | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
if (typeof navigator !== 'undefined') { | ||
window.__BEACONS = window.__BEACONS || [] | ||
|
||
navigator.sendBeacon = async function () { | ||
const args = await Promise.all( | ||
[...arguments].map((v) => { | ||
if (v instanceof Blob) { | ||
return v.text() | ||
} | ||
return v | ||
}) | ||
) | ||
|
||
window.__BEACONS.push(args) | ||
} | ||
} | ||
|
||
export default () => { | ||
return ( | ||
<div> | ||
<h1>Foo!</h1> | ||
<h2>bar!</h2> | ||
</div> | ||
) | ||
} |
72 changes: 72 additions & 0 deletions
72
test/integration/relay-analytics-disabled/test/index.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* eslint-env jest */ | ||
|
||
import fs from 'fs-extra' | ||
import { findPort, killApp, nextBuild, nextStart } from 'next-test-utils' | ||
import webdriver from 'next-webdriver' | ||
import path, { join } from 'path' | ||
|
||
const appDir = join(__dirname, '../') | ||
let appPort | ||
let server | ||
jest.setTimeout(1000 * 60 * 2) | ||
|
||
let buildManifest | ||
|
||
describe('Analytics relayer (disabled)', () => { | ||
let stdout | ||
beforeAll(async () => { | ||
appPort = await findPort() | ||
;({ stdout } = await nextBuild(appDir, [], { | ||
stdout: true, | ||
})) | ||
buildManifest = require(path.join( | ||
appDir, | ||
'.next/build-manifest.json' | ||
), 'utf8') | ||
server = await nextStart(appDir, appPort) | ||
}) | ||
afterAll(() => killApp(server)) | ||
|
||
it('Does not relay any data', async () => { | ||
const browser = await webdriver(appPort, '/') | ||
await browser.waitForElementByCss('h1') | ||
const h1Text = await browser.elementByCss('h1').text() | ||
const firstContentfulPaint = parseFloat( | ||
await browser.eval('localStorage.getItem("FCP")') | ||
) | ||
|
||
expect(h1Text).toMatch(/Foo!/) | ||
|
||
expect(firstContentfulPaint).not.toBeNaN() | ||
expect(firstContentfulPaint).toBeGreaterThan(0) | ||
|
||
const beacons = (await browser.eval('window.__BEACONS')).map(([, value]) => | ||
Object.fromEntries(new URLSearchParams(value)) | ||
) | ||
|
||
expect(beacons.length).toBe(0) | ||
|
||
expect(stdout).not.toMatch('Next.js Analytics') | ||
|
||
await browser.close() | ||
}) | ||
|
||
it('Does not include the code', async () => { | ||
const pageFiles = [ | ||
...new Set([ | ||
...buildManifest.pages['/'].filter((file) => file.endsWith('.js')), | ||
...buildManifest.pages['/_app'].filter((file) => file.endsWith('.js')), | ||
]), | ||
] | ||
|
||
expect(pageFiles.length).toBeGreaterThan(1) | ||
|
||
for (const pageFile of pageFiles) { | ||
const content = await fs.readFile( | ||
path.join(appDir, '.next', pageFile), | ||
'utf8' | ||
) | ||
expect(content).not.toMatch('vercel-analytics') | ||
} | ||
}) | ||
}) |
Oops, something went wrong.