Skip to content

Commit

Permalink
Merge branch 'canary' into fix/playwright-trace-names
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Oct 27, 2021
2 parents 079698a + 431178b commit 33a0d10
Show file tree
Hide file tree
Showing 31 changed files with 138 additions and 77 deletions.
62 changes: 28 additions & 34 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,13 @@ jobs:
- name: Check examples
run: ./scripts/check-examples.sh

checkIsRelease:
runs-on: ubuntu-latest
outputs:
isRelease: ${{ steps.check-release.outputs.IS_RELEASE }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 25
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- id: check-release
run: |
if [[ $(git describe --exact-match 2> /dev/null || :) = v* ]];
then
echo "::set-output name=IS_RELEASE::true"
else
echo "::set-output name=IS_RELEASE::false"
fi
build:
runs-on: ubuntu-latest
env:
NEXT_TELEMETRY_DISABLED: 1
outputs:
docsChange: ${{ steps.docs-change.outputs.DOCS_CHANGE }}
isRelease: ${{ steps.check-release.outputs.IS_RELEASE }}
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -49,12 +32,24 @@ jobs:
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off

- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: yarn install --frozen-lockfile --check-files
- run: node run-tests.js --timings --write-timings -g 1/1
- name: Check docs only change
run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change
- run: echo ${{steps.docs-change.outputs.DOCS_CHANGE}}
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: git describe
- id: check-release
run: |
if [[ $(git describe --exact-match 2> /dev/null || :) = v* ]];
then
echo "::set-output name=IS_RELEASE::true"
else
echo "::set-output name=IS_RELEASE::false"
fi
- uses: actions/cache@v2
id: cache-build
with:
Expand Down Expand Up @@ -410,11 +405,10 @@ jobs:
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

publishRelease:
if: ${{ needs.checkIsRelease.outputs.isRelease == 'true' }}
if: ${{ needs.build.outputs.isRelease == 'true' }}
name: Potentially publish release
runs-on: ubuntu-latest
needs:
- checkIsRelease
- build
- build-native
- build-windows-i686
Expand Down Expand Up @@ -587,8 +581,8 @@ jobs:
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}

build-windows-i686:
needs: checkIsRelease
if: ${{ needs.checkIsRelease.outputs.isRelease == 'true' }}
needs: build
if: ${{ needs.build.outputs.isRelease == 'true' }}
name: next-swc - windows-i686 - node@14
runs-on: windows-latest
env:
Expand Down Expand Up @@ -646,8 +640,8 @@ jobs:
path: packages/next/native/next-swc.win32-ia32-msvc.node

build-windows-aarch64:
needs: checkIsRelease
if: ${{ needs.checkIsRelease.outputs.isRelease == 'true' }}
needs: build
if: ${{ needs.build.outputs.isRelease == 'true' }}
name: next-swc - windows-aarch64 - node@14
runs-on: windows-latest
steps:
Expand Down Expand Up @@ -693,8 +687,8 @@ jobs:
path: packages/next/native/next-swc.win32-arm64-msvc.node

build-linux-musl:
needs: checkIsRelease
if: ${{ needs.checkIsRelease.outputs.isRelease == 'true' }}
needs: build
if: ${{ needs.build.outputs.isRelease == 'true' }}
name: next-swc - linux-musl - node@lts
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -747,8 +741,8 @@ jobs:
path: packages/next/native/next-swc.linux-x64-musl.node

build-linux-aarch64:
needs: checkIsRelease
if: ${{ needs.checkIsRelease.outputs.isRelease == 'true' }}
needs: build
if: ${{ needs.build.outputs.isRelease == 'true' }}
name: next-swc - aarch64-unknown-linux-gnu - node@14
runs-on: ubuntu-18.04
steps:
Expand Down Expand Up @@ -809,8 +803,8 @@ jobs:
path: packages/next/native/next-swc.linux-arm64-gnu.node

build-linux-aarch64-musl:
needs: checkIsRelease
if: ${{ needs.checkIsRelease.outputs.isRelease == 'true' }}
needs: build
if: ${{ needs.build.outputs.isRelease == 'true' }}
name: next-swc - aarch64-unknown-linux-musl - node@14
runs-on: ubuntu-18.04
steps:
Expand Down Expand Up @@ -869,8 +863,8 @@ jobs:
path: packages/next/native/next-swc.linux-arm64-musl.node

build-linux-arm7:
needs: checkIsRelease
if: ${{ needs.checkIsRelease.outputs.isRelease == 'true' }}
needs: build
if: ${{ needs.build.outputs.isRelease == 'true' }}
name: next-swc - arm7-unknown-linux-gnu - node@14
runs-on: ubuntu-18.04
steps:
Expand Down Expand Up @@ -931,8 +925,8 @@ jobs:
path: packages/next/native/next-swc.linux-arm-gnueabihf.node

build-android-aarch64:
needs: checkIsRelease
if: ${{ needs.checkIsRelease.outputs.isRelease == 'true' }}
needs: build
if: ${{ needs.build.outputs.isRelease == 'true' }}
name: next-swc - Android - aarch64
runs-on: macos-latest
steps:
Expand Down
10 changes: 1 addition & 9 deletions docs/basic-features/image-optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,7 @@ Loaders can be defined per-image, or at the application level.

You should add the `priority` property to the image that will be the [Largest Contentful Paint (LCP) element](https://web.dev/lcp/#what-elements-are-considered) for each page. Doing so allows Next.js to specially prioritize the image for loading (e.g. through preload tags or priority hints), leading to a meaningful boost in LCP.

The LCP element is typically the largest image or text block visible within the viewport of the page. You can verify which element this is by running the following code in the console of your page and looking at the latest result:

```javascript
new PerformanceObserver((entryList) => {
for (const entry of entryList.getEntries()) {
console.log('LCP candidate:', entry.startTime, entry.element)
}
}).observe({ type: 'largest-contentful-paint', buffered: true })
```
The LCP element is typically the largest image or text block visible within the viewport of the page. When you run `next dev`, you'll see a console warning if the LCP element is an `<Image>` without the `priority` property.

Once you've identified the LCP image, you can add the property like this:

Expand Down
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": "12.0.1-canary.3"
"version": "12.0.1"
}
1 change: 0 additions & 1 deletion packages/create-next-app/create-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ export async function createApp({
*/
const packageJson = {
name: appName,
version: '0.1.0',
private: true,
scripts: {
dev: 'next dev',
Expand Down
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": "12.0.1-canary.3",
"version": "12.0.1",
"keywords": [
"react",
"next",
Expand Down
3 changes: 2 additions & 1 deletion packages/create-next-app/templates/typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
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": "12.0.1-canary.3",
"version": "12.0.1",
"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": "12.0.1-canary.3",
"@next/eslint-plugin-next": "12.0.1",
"@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": "12.0.1-canary.3",
"version": "12.0.1",
"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": "12.0.1-canary.3",
"version": "12.0.1",
"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": "12.0.1-canary.3",
"version": "12.0.1",
"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": "12.0.1-canary.3",
"version": "12.0.1",
"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": "12.0.1-canary.3",
"version": "12.0.1",
"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": "12.0.1-canary.3",
"version": "12.0.1",
"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": "12.0.1-canary.3",
"version": "12.0.1",
"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": "12.0.1-canary.3",
"version": "12.0.1",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
7 changes: 5 additions & 2 deletions packages/next/build/swc/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ where

let s = cx.get::<JsString>(0)?.into_utf8()?;
let is_module = cx.get::<JsBoolean>(1)?;
let options: TransformOptions = cx.get_deserialized(2)?;
let mut options: TransformOptions = cx.get_deserialized(2)?;
options.swc.swcrc = false;

let output = try_with_handler(c.cm.clone(), true, |handler| {
c.run(|| {
Expand All @@ -144,7 +145,9 @@ where

#[js_function(4)]
pub fn transform(cx: CallContext) -> napi::Result<JsObject> {
schedule_transform(cx, |c, src, _, options| {
schedule_transform(cx, |c, src, _, mut options| {
options.swc.swcrc = false;

let input = Input::Source(c.cm.new_source_file(
if options.swc.filename.is_empty() {
FileName::Anon
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ export default async function getBaseWebpackConfig(
buildId,
rewrites,
isDevFallback,
exportRuntime: hasServerComponents,
exportRuntime: hasConcurrentFeatures,
}),
new ProfilingPlugin({ runWebpackSpan }),
config.optimizeFonts &&
Expand Down
6 changes: 5 additions & 1 deletion packages/next/client/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,11 @@ export default function Image({
)
}

if (typeof window !== 'undefined' && !perfObserver) {
if (
typeof window !== 'undefined' &&
!perfObserver &&
window.PerformanceObserver
) {
perfObserver = new PerformanceObserver((entryList) => {
for (const entry of entryList.getEntries()) {
// @ts-ignore - missing "LargestContentfulPaint" class with "element" prop
Expand Down
Loading

0 comments on commit 33a0d10

Please sign in to comment.