Skip to content

Commit

Permalink
Merge branch 'canary' into wbinnssmith/fix-safari
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi authored Aug 31, 2023
2 parents de5becb + cc77579 commit 7347c33
Show file tree
Hide file tree
Showing 35 changed files with 5,465 additions and 5,475 deletions.
2 changes: 1 addition & 1 deletion .github/actions/issue-validator/repro-link/index.mjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .github/actions/issue-validator/src/repro-link.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ async function run() {
state: 'closed',
})

await client.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['invalid link'],
})

// Comment on the issue
await client.issues.createComment({
owner: context.repo.owner,
Expand Down
42 changes: 36 additions & 6 deletions contributing/repository/triaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,47 @@ Repository maintainers triage every issue and PR opened in the repository.
Issues are opened with one of these labels:

- `template: bug` - unverified issue with Next.js itself, or one of the examples in the [`examples`](https://github.com/vercel/next.js/tree/canary/examples) folder
- `template: bug` - unverified issue with Next.js itself
- `template: documentation` - feedback for improvement or an unverified issue with the Next.js documentation
- `area: examples` - an issue with one of the examples in the [`examples`](https://github.com/vercel/next.js/tree/canary/examples) folder

In the case of a bug report, a maintainer looks at the provided reproduction. If the reproduction is missing or insufficient, a `please add a complete reproduction` label is added. If a reproduction is not provided for more than 30 days, the issue becomes stale and will be automatically closed. If a reproduction is provided within 30 days, the `please add a complete reproduction` label is removed and the issue will not become stale anymore.
## Bug reports

Bug reports must be verified against the `next@canary` release. The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces before opening a new issue. Issues not verified against `next@canary` will be closed after 30 days.
### Automated triaging

If the issue is specific to the project and not to Next.js itself, it might be converted to a [🎓️ Help discussion](https://github.com/vercel/next.js/discussions/categories/help)
In case of a bug report, **if the reproduction is missing or insufficient, the issue is automatically closed**, and a comment is added with a correct course of action. The issue will receive [this comment](https://github.com/vercel/next.js/blob/canary/.github/actions/issue-validator/repro-link/invalid-link.md). We also add an `invalid link` label to mark the issue. To avoid your issue being closed, please follow the [bug report template](https://github.com/vercel/next.js/blob/canary/.github/ISSUE_TEMPLATE/1.bug_report.yml) carefully.

If the bug is verified, it will receive the `kind: bug` label and will be tracked by the maintainers. An `area:` label can be added to indicate which part of Next.js is affected.
If you filled out the "Which area(s) are affected? (Select all that apply)" section of the bug report template, we will add the corresponding `area:` label(s).

### Manual triaging

If the issue is specific to the project and not to Next.js itself, it will be converted to a [🎓️ Help discussion](https://github.com/vercel/next.js/discussions/categories/help)

A maintainer can also manually label an issue with one of the following labels, which will also add a comment with a correct course of action:

1. `please add a complete reproduction`

The provided reproduction is not enough for the maintainers to investigate. If a sufficient reproduction is not provided for more than 30 days, the issue becomes stale and will be automatically closed. If a reproduction is provided within 30 days, a `needs triage` label is added, indicating that the issue needs another look from a maintainer.

The issue will receive [this comment](https://github.com/vercel/next.js/blob/canary/.github/actions/issue-validator/clarify/repro.md)

2. `please verify canary`

The issue is not verified against the `next@canary` release. The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces before opening a new issue. Issues not verified against `next@canary` will be closed after 30 days.

The issue will receive [this comment](https://github.com/vercel/next.js/blob/canary/.github/actions/issue-validator/clarify/canary.md)

3. `please simplify reproduction`

The provided reproduction is too complex or requires too many steps to reproduce. If a simplified reproduction is not provided for more than 30 days, the issue becomes stale and will be automatically closed. If a reproduction is provided within 30 days, a `needs triage` label is added, indicating that the issue needs another look from a maintainer.
The issue will receive [this comment](https://github.com/vercel/next.js/blob/canary/.github/actions/issue-validator/clarify/simplify-repro.md)

## Verified issues

If an issue is verified, it will receive the `linear: next`, `linear: dx` or `linear: web` label and will be tracked by the maintainers. Additionally, one or more `area:` label(s) can be added to indicate which part of Next.js is affected.

Confirmed issues never become stale or are closed before resolution.

All **closed** PRs and Issues will be locked after 30 days of inactivity (eg.: comment, referencing from elsewhere).
## Closed issues

All **closed** PRs and Issues will be locked after 2 weeks of inactivity (eg.: comment, referencing from elsewhere). If you think the issue is still relevant, please open a new issue and reference the old one.
6 changes: 3 additions & 3 deletions examples/with-sentry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
"lint": "next lint"
},
"dependencies": {
"@sentry/nextjs": "^7.46.0",
"@sentry/nextjs": "^7.60.1",
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^18.15.11",
"@types/react": "^18.0.32",
"typescript": "^4.8.2"
"@types/react": "^18.2.17",
"typescript": "^5.1.6"
}
}
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.20-canary.13"
"version": "13.4.20-canary.14"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"@typescript-eslint/eslint-plugin": "6.1.0",
"@typescript-eslint/parser": "6.1.0",
"@vercel/fetch": "6.1.1",
"@vercel/og": "0.5.9",
"@vercel/og": "0.5.12",
"@zeit/next-typescript": "1.1.2-canary.0",
"abort-controller": "3.0.0",
"alex": "9.1.0",
Expand Down Expand Up @@ -208,7 +208,7 @@
"request-promise-core": "1.1.2",
"resolve-from": "5.0.0",
"sass": "1.54.0",
"satori": "0.10.1",
"satori": "0.10.3",
"scheduler-builtin": "npm:[email protected]",
"scheduler-experimental-builtin": "npm:[email protected]",
"seedrandom": "3.0.5",
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": "13.4.20-canary.13",
"version": "13.4.20-canary.14",
"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.20-canary.13",
"version": "13.4.20-canary.14",
"description": "ESLint configuration used by Next.js.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
"dependencies": {
"@next/eslint-plugin-next": "13.4.20-canary.13",
"@next/eslint-plugin-next": "13.4.20-canary.14",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.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.20-canary.13",
"version": "13.4.20-canary.14",
"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.20-canary.13",
"version": "13.4.20-canary.14",
"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.20-canary.13",
"version": "13.4.20-canary.14",
"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.20-canary.13",
"version": "13.4.20-canary.14",
"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.20-canary.13",
"version": "13.4.20-canary.14",
"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.20-canary.13",
"version": "13.4.20-canary.14",
"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.20-canary.13",
"version": "13.4.20-canary.14",
"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.20-canary.13",
"version": "13.4.20-canary.14",
"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.20-canary.13",
"version": "13.4.20-canary.14",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion packages/next-swc/crates/next-api/src/middleware.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use anyhow::{bail, Context, Result};
use next_core::{
all_server_paths,
middleware::{get_middleware_module, wrap_edge_entry},
middleware::get_middleware_module,
mode::NextMode,
next_edge::entry::wrap_edge_entry,
next_manifests::{EdgeFunctionDefinition, MiddlewareMatcher, MiddlewaresManifestV2},
next_server::{get_server_runtime_entries, ServerContextType},
util::parse_config_from_source,
Expand Down
47 changes: 4 additions & 43 deletions packages/next-swc/crates/next-core/src/middleware.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
use anyhow::Result;
use indexmap::indexmap;
use indoc::writedoc;
use turbo_tasks::{Value, Vc};
use turbo_tasks_fs::{rope::RopeBuilder, File, FileSystemPath};
use turbopack_binding::turbopack::{
core::{
asset::AssetContent, context::AssetContext, module::Module, reference_type::ReferenceType,
virtual_source::VirtualSource,
},
ecmascript::utils::StringifyJs,
use turbo_tasks_fs::{File, FileSystemPath};
use turbopack_binding::turbopack::core::{
asset::AssetContent, context::AssetContext, module::Module, reference_type::ReferenceType,
virtual_source::VirtualSource,
};

use crate::util::{load_next_js_template, virtual_next_js_template_path};
Expand Down Expand Up @@ -55,38 +51,3 @@ pub async fn get_middleware_module(

Ok(module)
}

#[turbo_tasks::function]
pub async fn wrap_edge_entry(
context: Vc<Box<dyn AssetContext>>,
project_root: Vc<FileSystemPath>,
entry: Vc<Box<dyn Module>>,
original_name: String,
) -> Result<Vc<Box<dyn Module>>> {
use std::io::Write;
let mut source = RopeBuilder::default();
writedoc!(
source,
r#"
import * as module from "MODULE"
self._ENTRIES ||= {{}}
self._ENTRIES[{}] = module
"#,
StringifyJs(&format_args!("middleware_{}", original_name))
)?;
let file = File::from(source.build());
// TODO(alexkirsz) Figure out how to name this virtual asset.
let virtual_source = VirtualSource::new(
project_root.join("edge-wrapper.js".to_string()),
AssetContent::file(file.into()),
);
let inner_assets = indexmap! {
"MODULE".to_string() => entry
};

Ok(context.process(
Vc::upcast(virtual_source),
Value::new(ReferenceType::Internal(Vc::cell(inner_assets))),
))
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub async fn get_app_route_entry(
);

if is_edge {
rsc_entry = wrap_edge_entry(context, project_root, rsc_entry, original_page_name.clone());
rsc_entry = wrap_edge_entry(context, project_root, rsc_entry, pathname.clone());
}

let Some(rsc_entry) =
Expand Down
46 changes: 46 additions & 0 deletions packages/next-swc/crates/next-core/src/next_edge/entry.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use anyhow::Result;
use indexmap::indexmap;
use indoc::formatdoc;
use turbo_tasks::{Value, Vc};
use turbo_tasks_fs::{File, FileSystemPath};
use turbopack_binding::turbopack::{
core::{
asset::AssetContent, context::AssetContext, module::Module, reference_type::ReferenceType,
virtual_source::VirtualSource,
},
ecmascript::utils::StringifyJs,
};

#[turbo_tasks::function]
pub async fn wrap_edge_entry(
context: Vc<Box<dyn AssetContext>>,
project_root: Vc<FileSystemPath>,
entry: Vc<Box<dyn Module>>,
pathname: String,
) -> Result<Vc<Box<dyn Module>>> {
let source = formatdoc!(
r#"
import * as module from "MODULE"
self._ENTRIES ||= {{}}
self._ENTRIES[{}] = module
"#,
StringifyJs(&format_args!("middleware_{}", pathname))
);
let file = File::from(source);

// TODO(alexkirsz) Figure out how to name this virtual asset.
let virtual_source = VirtualSource::new(
project_root.join("edge-wrapper.js".to_string()),
AssetContent::file(file.into()),
);

let inner_assets = indexmap! {
"MODULE".to_string() => entry
};

Ok(context.process(
Vc::upcast(virtual_source),
Value::new(ReferenceType::Internal(Vc::cell(inner_assets))),
))
}
1 change: 1 addition & 0 deletions packages/next-swc/crates/next-core/src/next_edge/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod context;
pub mod entry;
pub mod page_transition;
pub mod route_regex;
pub mod route_transition;
Loading

0 comments on commit 7347c33

Please sign in to comment.