diff --git a/examples/using-preact/README.md b/examples/using-preact/README.md index 8a87016ca4eae..2a958ec90ede1 100644 --- a/examples/using-preact/README.md +++ b/examples/using-preact/README.md @@ -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: diff --git a/examples/using-preact/package.json b/examples/using-preact/package.json index c9f1e1c54cb2d..6bc38905341d4 100644 --- a/examples/using-preact/package.json +++ b/examples/using-preact/package.json @@ -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": { diff --git a/lerna.json b/lerna.json index 0f6e1183c5b83..06e617259acf0 100644 --- a/lerna.json +++ b/lerna.json @@ -12,5 +12,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "9.2.2-canary.4" + "version": "9.2.2-canary.6" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 377c92ceb1a15..229ca80488b06 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "9.2.2-canary.4", + "version": "9.2.2-canary.6", "keywords": [ "react", "next", diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 04fee56d93b6e..c3de31ef8bb62 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -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": { diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 19a6253cd18a8..79b2fd00326d6 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -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": { diff --git a/packages/next-plugin-google-analytics/package.json b/packages/next-plugin-google-analytics/package.json index be3b5f9ee86e2..c4cbfabf6f3c3 100644 --- a/packages/next-plugin-google-analytics/package.json +++ b/packages/next-plugin-google-analytics/package.json @@ -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": [ diff --git a/packages/next-plugin-material-ui/package.json b/packages/next-plugin-material-ui/package.json index 647fe963873de..b320c985396a6 100644 --- a/packages/next-plugin-material-ui/package.json +++ b/packages/next-plugin-material-ui/package.json @@ -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": [] diff --git a/packages/next-plugin-sentry/package.json b/packages/next-plugin-sentry/package.json index 9cf74fb552909..4883fee6db014 100644 --- a/packages/next-plugin-sentry/package.json +++ b/packages/next-plugin-sentry/package.json @@ -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": [ diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index e691cd6450ba7..3836822c0d86e 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -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", diff --git a/packages/next/export/index.ts b/packages/next/export/index.ts index b23b0890f3983..40f0c33ca6885 100644 --- a/packages/next/export/index.ts +++ b/packages/next/export/index.ts @@ -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 diff --git a/packages/next/export/worker.js b/packages/next/export/worker.js index 68a1307b519dd..61a2a88e2517d 100644 --- a/packages/next/export/worker.js +++ b/packages/next/export/worker.js @@ -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` diff --git a/packages/next/package.json b/packages/next/package.json index 38d5cf5371bab..f2d79a8d9dcd4 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -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", @@ -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", diff --git a/test/integration/amphtml-custom-validator/next.config.js b/test/integration/amphtml-custom-validator/next.config.js new file mode 100644 index 0000000000000..60668d95da8fa --- /dev/null +++ b/test/integration/amphtml-custom-validator/next.config.js @@ -0,0 +1,7 @@ +module.exports = { + experimental: { + amp: { + validator: 'https://cdn.ampproject.org/v0/validator.js', + }, + }, +} diff --git a/test/integration/amphtml-custom-validator/pages/index.js b/test/integration/amphtml-custom-validator/pages/index.js new file mode 100644 index 0000000000000..b4d8c8f0e616e --- /dev/null +++ b/test/integration/amphtml-custom-validator/pages/index.js @@ -0,0 +1,5 @@ +export const config = { + amp: true, +} + +export default () =>

Hello from AMP

diff --git a/test/integration/amphtml-custom-validator/test/index.test.js b/test/integration/amphtml-custom-validator/test/index.test.js new file mode 100644 index 0000000000000..24d67151fad6d --- /dev/null +++ b/test/integration/amphtml-custom-validator/test/index.test.js @@ -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') + }) +})