Skip to content

Commit

Permalink
Merge branch 'canary' into fix/500_response_status
Browse files Browse the repository at this point in the history
  • Loading branch information
dpnolte authored Oct 15, 2023
2 parents b81d7e2 + b660eef commit 6ed114f
Show file tree
Hide file tree
Showing 40 changed files with 220 additions and 126 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/test_e2e_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
TURBO_REMOTE_ONLY: 'true'
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
NEXT_TELEMETRY_DISABLED: 1
# we build a dev binary for use in CI so skip downloading
# canary next-swc binaries in the monorepo
NEXT_SKIP_NATIVE_POSTINSTALL: 1

strategy:
fail-fast: false
Expand All @@ -50,11 +47,6 @@ jobs:

- run: npm i -g vercel@latest

- uses: actions/download-artifact@v3
with:
name: next-swc-binaries
path: packages/next-swc/native

- run: RESET_VC_PROJECT=true node scripts/reset-vercel-project.mjs
name: Reset test project

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Add Cypress to the `package.json` scripts field:
Run Cypress for the first time to generate examples that use their recommended folder structure:

```bash filename="Terminal"
npm run cypress
npm run cypress:open
```

You can look through the generated examples and the [Writing Your First Test](https://docs.cypress.io/guides/getting-started/writing-your-first-test) section of the Cypress Documentation to help you get familiar with Cypress.
Expand Down
2 changes: 1 addition & 1 deletion docs/04-architecture/supported-browsers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ We inject [widely used polyfills](https://github.com/vercel/next.js/blob/canary/
- [**URL**](https://developer.mozilla.org/docs/Web/API/URL) — Replacing: the [`url` package (Node.js API)](https://nodejs.org/api/url.html).
- [**Object.assign()**](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) — Replacing: `object-assign`, `object.assign`, and `core-js/object/assign`.

If any of your dependencies includes these polyfills, they’ll be eliminated automatically from the production build to avoid duplication.
If any of your dependencies include these polyfills, they’ll be eliminated automatically from the production build to avoid duplication.

In addition, to reduce bundle size, Next.js will only load these polyfills for browsers that require them. The majority of the web traffic globally will not download these polyfills.

Expand Down
2 changes: 1 addition & 1 deletion errors/404-get-initial-props.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Adding `getInitialProps` or `getServerSideProps` to your `404.js` page will caus

To fix this error, you should remove `getInitialProps` from your `404.js` page. Additionally, ensure that no Higher-Order Components (HOCs) used in the `404.js` page are attaching `getInitialProps`.

If your `404.js` page requires data fetching, we recommend incrementall adopting the App Router and the [`not-found`](/docs/app/api-reference/file-conventions/not-found) file, which does support fetching data before displaying the 404 page.
If your `404.js` page requires data fetching, we recommend incrementally adopting the App Router and the [`not-found`](/docs/app/api-reference/file-conventions/not-found) file, which does support fetching data before displaying the 404 page.

## Useful Links

Expand Down
2 changes: 1 addition & 1 deletion errors/api-routes-static-export.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To resolve this issue, you have two main options:

1. Use the `next build` command instead of `next export` if you're deploying your application on platforms that don't require `next export`. For example, [Vercel](https://vercel.com) is a popular hosting platform for Next.js applications that supports this feature.
2. If you still need to use `next export`, make sure to remove any paths that use API routes from your `exportPathMap` in your `next.config.js` file.
3. Consider [incrementally adopting the App Router](/docs/app/building-your-application/upgrading/app-router-migration), which supportes [Route Handlers](/docs/app/building-your-application/routing/route-handlers). These "API Routes" can be used to create endpoints that can be statically exported in your application.
3. Consider [incrementally adopting the App Router](/docs/app/building-your-application/upgrading/app-router-migration), which supports [Route Handlers](/docs/app/building-your-application/routing/route-handlers). These "API Routes" can be used to create endpoints that can be statically exported in your application.

## Useful Links

Expand Down
2 changes: 1 addition & 1 deletion examples/with-mqtt-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cp .env.local.example .env.local
Then set each variable on `.env.local`:

- `NEXT_MQTT_URI`: The URI of the broker. For example `wss://test.mosquitto.org:8081/mqtt`
- `NEXT_MQTT_CLIENTID`: An arbritrary string of max. 23 characters.
- `NEXT_MQTT_CLIENTID`: An arbitrary string of max. 23 characters.
- `NEXT_MQTT_USERNAME`: The username for the connection to the broker.
- `NEXT_MQTT_PASSWORD`: The password for the connection to the broker.

Expand Down
2 changes: 1 addition & 1 deletion examples/with-quill-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[Quill](https://quilljs.com/) is powerful rich text editor. This example uses [react-quill](https://github.com/zenoamaro/react-quill) to integrate Quill with Next.js.

Quill does not suppport SSR, so it's only loaded and rendered in the browser.
Quill does not support SSR, so it's only loaded and rendered in the browser.

## Deploy your own

Expand Down
2 changes: 1 addition & 1 deletion examples/with-supabase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- [Supabase Auth](https://supabase.com/auth) using cookies, making the user's session available throughout the entire Next.js app, for both client and server.
- Styling with [Tailwind CSS](https://tailwindcss.com)
- Optional deployment with [Supabase Vercel Integration and Vercel deploy](#deploy-your-own)
- Enviroment variables automatically assigned to Vercel project
- Environment variables automatically assigned to Vercel project

## Demo

Expand Down
2 changes: 1 addition & 1 deletion examples/with-temporal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Charging user 123 for 2 of item B102
Here is the Temporal code:

- The Workflow: `temporal/src/workflows/order.ts`
- The Activites: `temporal/src/activities/{payment|inventory}.ts`
- The Activities: `temporal/src/activities/{payment|inventory}.ts`

There are three parts of this starter project that are left unimplemented:

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.5.5-canary.13"
"version": "13.5.5-canary.16"
}
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.5.5-canary.13",
"version": "13.5.5-canary.16",
"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.5.5-canary.13",
"version": "13.5.5-canary.16",
"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.5.5-canary.13",
"@next/eslint-plugin-next": "13.5.5-canary.16",
"@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.5.5-canary.13",
"version": "13.5.5-canary.16",
"description": "ESLint plugin for Next.js.",
"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.5.5-canary.13",
"version": "13.5.5-canary.16",
"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.5.5-canary.13",
"version": "13.5.5-canary.16",
"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.5.5-canary.13",
"version": "13.5.5-canary.16",
"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.5.5-canary.13",
"version": "13.5.5-canary.16",
"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.5.5-canary.13",
"version": "13.5.5-canary.16",
"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.5.5-canary.13",
"version": "13.5.5-canary.16",
"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.5.5-canary.13",
"version": "13.5.5-canary.16",
"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.5.5-canary.13",
"version": "13.5.5-canary.16",
"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-swc/crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ impl AppEndpoint {
.await?
.preferred_region
.clone()
.map(Regions::Single),
.map(Regions::Multiple),
matchers: vec![matchers],
..Default::default()
};
Expand Down
35 changes: 30 additions & 5 deletions packages/next-swc/crates/next-core/src/app_segment_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub struct NextSegmentConfig {
pub revalidate: Option<NextRevalidate>,
pub fetch_cache: Option<NextSegmentFetchCache>,
pub runtime: Option<NextRuntime>,
pub preferred_region: Option<String>,
pub preferred_region: Option<Vec<String>>,
}

#[turbo_tasks::value_impl]
Expand Down Expand Up @@ -358,12 +358,37 @@ fn parse_config_value(
}
"preferredRegion" => {
let value = eval_context.eval(init);
let Some(val) = value.as_str() else {
invalid_config("`preferredRegion` needs to be a static string", &value);
return;

let preferred_region = match value {
// Single value is turned into a single-element Vec.
JsValue::Constant(ConstantValue::Str(str)) => vec![str.to_string()],
// Array of strings is turned into a Vec. If one of the values in not a String it
// will error.
JsValue::Array { items, .. } => {
let mut regions = Vec::new();
for item in items {
if let JsValue::Constant(ConstantValue::Str(str)) = item {
regions.push(str.to_string());
} else {
invalid_config(
"Values of the `preferredRegion` array need to static strings",
&item,
);
return;
}
}
regions
}
_ => {
invalid_config(
"`preferredRegion` needs to be a static string or array of static strings",
&value,
);
return;
}
};

config.preferred_region = Some(val.to_string());
config.preferred_region = Some(preferred_region);
}
_ => {}
}
Expand Down
30 changes: 29 additions & 1 deletion packages/next-swc/crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ pub async fn get_next_client_import_map(
)
.await?;

insert_optimized_module_aliases(&mut import_map, project_path).await?;

insert_alias_option(
&mut import_map,
project_path,
Expand Down Expand Up @@ -420,6 +422,8 @@ pub async fn get_next_edge_import_map(
)
.await?;

insert_optimized_module_aliases(&mut import_map, project_path).await?;

insert_alias_option(
&mut import_map,
project_path,
Expand Down Expand Up @@ -936,8 +940,32 @@ pub fn mdx_import_source_file() -> String {
format!("{VIRTUAL_PACKAGE_NAME}/mdx-import-source")
}

// Insert aliases for Next.js stubs of fetch, object-assign, and url
// Keep in sync with getOptimizedModuleAliases in webpack-config.ts
async fn insert_optimized_module_aliases(
import_map: &mut ImportMap,
project_path: Vc<FileSystemPath>,
) -> Result<()> {
insert_exact_alias_map(
import_map,
project_path,
indexmap! {
"unfetch" => "next/dist/build/polyfills/fetch/index.js".to_string(),
"isomorphic-unfetch" => "next/dist/build/polyfills/fetch/index.js".to_string(),
"whatwg-fetch" => "next/dist/build/polyfills/fetch/whatwg-fetch.js".to_string(),
"object-assign" => "next/dist/build/polyfills/object-assign.js".to_string(),
"object.assign/auto" => "next/dist/build/polyfills/object.assign/auto.js".to_string(),
"object.assign/implementation" => "next/dist/build/polyfills/object.assign/implementation.js".to_string(),
"object.assign/polyfill" => "next/dist/build/polyfills/object.assign/polyfill.js".to_string(),
"object.assign/shim" => "next/dist/build/polyfills/object.assign/shim.js".to_string(),
"url" => "next/dist/compiled/native-url".to_string(),
},
);
Ok(())
}

// Make sure to not add any external requests here.
pub async fn insert_next_shared_aliases(
async fn insert_next_shared_aliases(
import_map: &mut ImportMap,
project_path: Vc<FileSystemPath>,
execution_context: Vc<ExecutionContext>,
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.5.5-canary.13",
"version": "13.5.5-canary.16",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
16 changes: 8 additions & 8 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "13.5.5-canary.13",
"version": "13.5.5-canary.16",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -90,7 +90,7 @@
]
},
"dependencies": {
"@next/env": "13.5.5-canary.13",
"@next/env": "13.5.5-canary.16",
"@swc/helpers": "0.5.2",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406",
Expand Down Expand Up @@ -144,11 +144,11 @@
"@mswjs/interceptors": "0.23.0",
"@napi-rs/cli": "2.16.2",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.5.5-canary.13",
"@next/polyfill-nomodule": "13.5.5-canary.13",
"@next/react-dev-overlay": "13.5.5-canary.13",
"@next/react-refresh-utils": "13.5.5-canary.13",
"@next/swc": "13.5.5-canary.13",
"@next/polyfill-module": "13.5.5-canary.16",
"@next/polyfill-nomodule": "13.5.5-canary.16",
"@next/react-dev-overlay": "13.5.5-canary.16",
"@next/react-refresh-utils": "13.5.5-canary.16",
"@next/swc": "13.5.5-canary.16",
"@opentelemetry/api": "1.4.1",
"@playwright/test": "^1.35.1",
"@taskr/clear": "1.1.0",
Expand Down Expand Up @@ -302,7 +302,7 @@
"timers-browserify": "2.0.12",
"tty-browserify": "0.0.1",
"ua-parser-js": "1.0.35",
"undici": "5.23.0",
"undici": "5.26.3",
"unistore": "3.4.1",
"util": "0.12.4",
"uuid": "8.3.2",
Expand Down
Loading

0 comments on commit 6ed114f

Please sign in to comment.