Skip to content

Commit

Permalink
Merge branch 'canary' into canary
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDSCPL authored Feb 2, 2020
2 parents 188dcf3 + e90af3f commit c7dab83
Show file tree
Hide file tree
Showing 16 changed files with 76 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/using-preact/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Preact example

This example uses [Preact](https://github.com/developit/preact) instead of React. It's a React like UI framework which is fast and small. Here we've customized Next.js to use Preact instead of React.
This example uses [Preact](https://github.com/preactjs/preact) instead of React. It's a React like UI framework which is fast and small. Here we've customized Next.js to use Preact instead of React.

Here's how we did it:

Expand Down
4 changes: 2 additions & 2 deletions examples/using-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"dependencies": {
"module-alias": "2.2.2",
"next": "latest",
"preact": "10.0.0",
"preact-render-to-string": "5.0.7"
"preact": "10.2.1",
"preact-render-to-string": "5.1.4"
},
"license": "ISC",
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "9.2.2-canary.4"
"version": "9.2.2-canary.6"
}
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": "9.2.2-canary.4",
"version": "9.2.2-canary.6",
"keywords": [
"react",
"next",
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": "9.2.2-canary.4",
"version": "9.2.2-canary.6",
"main": "index.js",
"license": "MIT",
"repository": {
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": "9.2.2-canary.4",
"version": "9.2.2-canary.6",
"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": "9.2.2-canary.4",
"version": "9.2.2-canary.6",
"nextjs": {
"name": "Google Analytics",
"required-env": [
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-material-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-material-ui",
"version": "9.2.2-canary.4",
"version": "9.2.2-canary.6",
"nextjs": {
"name": "Material UI",
"required-env": []
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": "9.2.2-canary.4",
"version": "9.2.2-canary.6",
"nextjs": {
"name": "Sentry",
"required-env": [
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": "9.2.2-canary.4",
"version": "9.2.2-canary.6",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export default async function(
hotReloader: null,
canonicalBase: nextConfig.amp?.canonicalBase || '',
isModern: nextConfig.experimental.modern,
ampValidator: nextConfig.experimental.amp?.validator || undefined,
ampValidatorPath: nextConfig.experimental.amp?.validator || undefined,
}

const { serverRuntimeConfig, publicRuntimeConfig } = nextConfig
Expand Down
2 changes: 1 addition & 1 deletion packages/next/export/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export default async function({
}

if (curRenderOpts.inAmpMode) {
await validateAmp(html, path, curRenderOpts.ampValidator)
await validateAmp(html, path, curRenderOpts.ampValidatorPath)
} else if (curRenderOpts.hybridAmp) {
// we need to render the AMP version
let ampHtmlFilename = `${ampPath}${sep}index.html`
Expand Down
4 changes: 2 additions & 2 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "9.2.2-canary.4",
"version": "9.2.2-canary.6",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -73,7 +73,7 @@
"@babel/preset-typescript": "7.7.2",
"@babel/runtime": "7.7.2",
"@babel/runtime-corejs2": "7.7.2",
"@next/polyfill-nomodule": "9.2.2-canary.4",
"@next/polyfill-nomodule": "9.2.2-canary.6",
"amphtml-validator": "1.0.23",
"async-retry": "1.2.3",
"async-sema": "3.0.0",
Expand Down
7 changes: 7 additions & 0 deletions test/integration/amphtml-custom-validator/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: 'https://cdn.ampproject.org/v0/validator.js',
},
},
}
5 changes: 5 additions & 0 deletions test/integration/amphtml-custom-validator/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const config = {
amp: true,
}

export default () => <p>Hello from AMP</p>
49 changes: 49 additions & 0 deletions test/integration/amphtml-custom-validator/test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
nextBuild,
findPort,
nextStart,
killApp,
launchApp,
renderViaHTTP,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1

let app
let appPort
const appDir = join(__dirname, '../')

describe('AMP Custom Validator', () => {
it('should build and start successfully', async () => {
const { code } = await nextBuild(appDir)
expect(code).toBe(0)

appPort = await findPort()
app = await nextStart(appDir, appPort)

const html = await renderViaHTTP(appPort, '/')
await killApp(app)

expect(html).toContain('Hello from AMP')
})

it('should run in dev mode successfully', async () => {
let stderr = ''

appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStderr(msg) {
stderr += msg || ''
},
})

const html = await renderViaHTTP(appPort, '/')
await killApp(app)

expect(stderr).not.toContain('error')
expect(html).toContain('Hello from AMP')
})
})

0 comments on commit c7dab83

Please sign in to comment.