Skip to content

Commit

Permalink
Merge branch 'canary' of github.com:vercel/next.js into ykzts-quality…
Browse files Browse the repository at this point in the history
…-num

# Conflicts:
#	packages/next/client/image.tsx
  • Loading branch information
timneutkens committed Oct 27, 2020
2 parents c9984d8 + 080b91f commit be3c95a
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/api-reference/next/image.md
Expand Up @@ -49,7 +49,7 @@ export default Home
- `width` - The intrinsic width of the source image in pixels. Must be an integer without a unit. Required unless `unsized` is true.
- `height` - The intrinsic height of the source image, in pixels. Must be an integer without a unit. Required unless `unsized` is true.
- `sizes` - Defines what proportion of the screen you expect the image to take up. Recommended, as it helps serve the correct sized image to each device. [More info](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-sizes).
- `quality` - The quality of the optimized image, an integer between 1 and 100 where 100 is the best quality. Default 100.
- `quality` - The quality of the optimized image, an integer between 1 and 100 where 100 is the best quality. Default 75.
- `loading` - The loading behavior. When `lazy`, defer loading the image until it reaches a calculated distance from the viewport. When `eager`, load the image immediately. Default `lazy`. [More info](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading)
- `priority` - When true, the image will be considered high priority and [preload](https://web.dev/preload-responsive-images/).
- `unoptimized` - When true, the source image will be served as-is instead of resizing and changing quality.
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "9.5.6-canary.16"
"version": "9.5.6-canary.17"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"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
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-google-analytics/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-google-analytics",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"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
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-sentry",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-sentry"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"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
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"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/client/image.tsx
Expand Up @@ -444,5 +444,5 @@ function defaultLoader({ root, src, width, quality }: LoaderProps): string {
}
}

return `${root}?url=${encodeURIComponent(src)}&w=${width}&q=${quality || 100}`
return `${root}?url=${encodeURIComponent(src)}&w=${width}&q=${quality || 75}`
}
12 changes: 6 additions & 6 deletions packages/next/package.json
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -79,10 +79,10 @@
"@babel/runtime": "7.11.2",
"@babel/types": "7.11.5",
"@hapi/accept": "5.0.1",
"@next/env": "9.5.6-canary.16",
"@next/polyfill-module": "9.5.6-canary.16",
"@next/react-dev-overlay": "9.5.6-canary.16",
"@next/react-refresh-utils": "9.5.6-canary.16",
"@next/env": "9.5.6-canary.17",
"@next/polyfill-module": "9.5.6-canary.17",
"@next/react-dev-overlay": "9.5.6-canary.17",
"@next/react-refresh-utils": "9.5.6-canary.17",
"ast-types": "0.13.2",
"babel-plugin-transform-define": "2.0.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
Expand Down Expand Up @@ -129,7 +129,7 @@
"sharp": "0.26.2"
},
"devDependencies": {
"@next/polyfill-nomodule": "9.5.6-canary.16",
"@next/polyfill-nomodule": "9.5.6-canary.17",
"@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
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"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
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "9.5.6-canary.16",
"version": "9.5.6-canary.17",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
23 changes: 23 additions & 0 deletions test/integration/image-component/default/test/index.test.js
Expand Up @@ -22,6 +22,19 @@ const nextConfig = join(appDir, 'next.config.js')
let appPort
let app

async function hasImageMatchingUrl(browser, url) {
const links = await browser.elementsByCss('img')
let foundMatch = false
for (const link of links) {
const src = await link.getAttribute('src')
if (src === url) {
foundMatch = true
break
}
}
return foundMatch
}

function runTests(mode) {
it('should load the images', async () => {
let browser
Expand Down Expand Up @@ -54,6 +67,16 @@ function runTests(mode) {

return 'result-correct'
}, /result-correct/)

expect(
await hasImageMatchingUrl(
browser,
mode === 'serverless'
? // FIXME: this is a bug
`http://localhost:${appPort}/_next/image/?url=%2Ftest.jpg&w=420&q=75`
: `http://localhost:${appPort}/_next/image?url=%2Ftest.jpg&w=420&q=75`
)
).toBe(true)
} finally {
if (browser) {
await browser.close()
Expand Down

0 comments on commit be3c95a

Please sign in to comment.