Skip to content

Commit

Permalink
Merge branch 'canary' into get-pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
styfle authored Jun 2, 2023
2 parents d490912 + 18d112f commit c2c77d6
Show file tree
Hide file tree
Showing 26 changed files with 136 additions and 87 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: build-and-deploy
on:
push:
branches: ['canary']
workflow_dispatch:

env:
NAPI_CLI_VERSION: 2.14.7
Expand All @@ -24,7 +25,7 @@ jobs:
outputs:
docsChange: ${{ steps.docs-change.outputs.DOCS_CHANGE }}
codemodChange: ${{ steps.codemod-change.outputs.CODEMOD_CHANGE }}
isRelease: ${{ steps.check-release.outputs.IS_RELEASE }}
isRelease: ${{ github.event_name != 'workflow_dispatch' && steps.check-release.outputs.IS_RELEASE }}
swcChange: ${{ steps.swc-change.outputs.SWC_CHANGE }}
turboToken: ${{ steps.turbo-token.outputs.TURBO_TOKEN }}
weekNum: ${{ steps.get-week.outputs.WEEK }}
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "13.4.5-canary.3"
"version": "13.4.5-canary.4"
}
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": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"keywords": [
"react",
"next",
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": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"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": "13.4.5-canary.3",
"@next/eslint-plugin-next": "13.4.5-canary.4",
"@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.42.0",
"eslint-import-resolver-node": "^0.3.6",
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": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"description": "ESLint plugin for NextJS.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/font",
"version": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
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": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
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": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"license": "MIT",
"repository": {
"type": "git",
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": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"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": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"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": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"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": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"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": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,18 @@ use crate::{
};

/// An entry in the Google fonts metrics map
#[derive(Deserialize)]
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub(super) struct FontMetricsMapEntry {
#[allow(unused)]
family_name: String,
category: String,
#[allow(unused)]
cap_height: i32,
ascent: i32,
descent: i32,
line_gap: u32,
units_per_em: u32,
#[allow(unused)]
x_height: i32,
x_width_avg: f64,
}

#[derive(Deserialize)]
#[derive(Deserialize, Debug)]
pub(super) struct FontMetricsMap(pub HashMap<String, FontMetricsMapEntry>);

#[derive(Debug, PartialEq, Serialize, Deserialize, TraceRawVcs)]
Expand All @@ -61,49 +55,44 @@ pub(super) async fn get_font_fallback(
Some(fallback) => FontFallback::Manual(StringsVc::cell(fallback.clone())).cell(),
None => {
let metrics_json =
load_next_json(context, "/dist/server/capsize-font-metrics.json").await;
match metrics_json {
Ok(metrics_json) => {
let fallback = lookup_fallback(
&options.font_family,
metrics_json,
options.adjust_font_fallback,
);

match fallback {
Ok(fallback) => FontFallback::Automatic(
AutomaticFontFallback {
scoped_font_family: get_scoped_font_family(
FontFamilyType::Fallback.cell(),
options_vc.font_family(),
request_hash,
),
local_font_family: StringVc::cell(fallback.font_family),
adjustment: fallback.adjustment,
}
.cell(),
)
.cell(),
Err(_) => {
NextFontIssue {
path: context,
title: StringVc::cell(format!(
"Failed to find font override values for font `{}`",
&options.font_family,
)),
description: StringVc::cell(
"Skipping generating a fallback font.".to_owned(),
),
severity: IssueSeverity::Warning.cell(),
}
.cell()
.as_issue()
.emit();
FontFallback::Error.cell()
}
load_next_json(context, "/dist/server/capsize-font-metrics.json").await?;
let fallback = lookup_fallback(
&options.font_family,
metrics_json,
options.adjust_font_fallback,
);

match fallback {
Ok(fallback) => FontFallback::Automatic(
AutomaticFontFallback {
scoped_font_family: get_scoped_font_family(
FontFamilyType::Fallback.cell(),
options_vc.font_family(),
request_hash,
),
local_font_family: StringVc::cell(fallback.font_family),
adjustment: fallback.adjustment,
}
.cell(),
)
.cell(),
Err(_) => {
NextFontIssue {
path: context,
title: StringVc::cell(format!(
"Failed to find font override values for font `{}`",
&options.font_family,
)),
description: StringVc::cell(
"Skipping generating a fallback font.".to_owned(),
),
severity: IssueSeverity::Warning.cell(),
}
.cell()
.as_issue()
.emit();
FontFallback::Error.cell()
}
Err(_) => FontFallback::Error.cell(),
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -83,7 +83,7 @@
]
},
"dependencies": {
"@next/env": "13.4.5-canary.3",
"@next/env": "13.4.5-canary.4",
"@swc/helpers": "0.5.1",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406",
Expand Down Expand Up @@ -140,11 +140,11 @@
"@jest/types": "29.5.0",
"@napi-rs/cli": "2.14.7",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.4.5-canary.3",
"@next/polyfill-nomodule": "13.4.5-canary.3",
"@next/react-dev-overlay": "13.4.5-canary.3",
"@next/react-refresh-utils": "13.4.5-canary.3",
"@next/swc": "13.4.5-canary.3",
"@next/polyfill-module": "13.4.5-canary.4",
"@next/polyfill-nomodule": "13.4.5-canary.4",
"@next/react-dev-overlay": "13.4.5-canary.4",
"@next/react-refresh-utils": "13.4.5-canary.4",
"@next/swc": "13.4.5-canary.4",
"@opentelemetry/api": "1.4.1",
"@segment/ajv-human-errors": "2.1.2",
"@taskr/clear": "1.1.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/next/src/client/components/draft-mode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DraftModeProvider } from '../../server/async-storage/draft-mode-provider'
import type { DraftModeProvider } from '../../server/async-storage/draft-mode-provider'

import { staticGenerationBailout } from './static-generation-bailout'

export class DraftMode {
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/server/app-render/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export type RenderOptsPartial = {
nextConfigOutput?: 'standalone' | 'export'
appDirDevErrorLogger?: (err: any) => Promise<void>
originalPathname?: string
isDraftMode?: boolean
deploymentId?: string
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type StaticGenerationContext = {
isBot?: boolean
nextExport?: boolean
fetchCache?: StaticGenerationStore['fetchCache']
isDraftMode?: boolean

/**
* A hack around accessing the store value outside the context of the
Expand Down Expand Up @@ -46,11 +47,15 @@ export const StaticGenerationAsyncStorageWrapper: AsyncStorageWrapper<
* or throw an error. It is the sole responsibility of the caller to
* ensure they aren't e.g. requesting dynamic HTML for an AMP page.
*
* 3.) If the request is in draft mode, we must generate dynamic HTML.
*
* These rules help ensure that other existing features like request caching,
* coalescing, and ISR continue working as intended.
*/
const isStaticGeneration =
!renderOpts.supportsDynamicHTML && !renderOpts.isBot
!renderOpts.supportsDynamicHTML &&
!renderOpts.isBot &&
!renderOpts.isDraftMode

const store: StaticGenerationStore = {
isStaticGeneration,
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,7 @@ export default abstract class Server<ServerOptions extends Options = Options> {

supportsDynamicHTML,
isOnDemandRevalidate,
isDraftMode: isPreviewMode,
}

const renderResult = await this.renderHTML(
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/server/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export type RenderOptsPartial = {
largePageDataBytes?: number
isOnDemandRevalidate?: boolean
strictNextHead: boolean
isDraftMode?: boolean
deploymentId?: string
}

Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "13.4.5-canary.3",
"version": "13.4.5-canary.4",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c2c77d6

Please sign in to comment.