Skip to content

Commit

Permalink
Merge branch 'canary' into fix/preload-link-tag-missing-cross-origin
Browse files Browse the repository at this point in the history
  • Loading branch information
devjiwonchoi authored Jul 4, 2024
2 parents 65034bd + f0abeb8 commit 83d55ed
Show file tree
Hide file tree
Showing 68 changed files with 502 additions and 388 deletions.
56 changes: 54 additions & 2 deletions .github/workflows/notify_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ name: Notify new Next.js release
on:
release:
types: [published]

jobs:
notify:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
steps:
- uses: actions/github-script@v7
id: notify-new-release
with:
result-encoding: string
retries: 3
retry-exempt-status-codes: 400,401
# Default github token cannot dispath events to the remote repo, it should be
# Default github token cannot dispatch events to the remote repo, it should be
# a PAT with access to contenst:read&write + metadata:read.
github-token: ${{ secrets.TURBOPACK_TEST_TOKEN }}
# Note `event_type` and `client_payload` are contract between vercel/turbo,
Expand All @@ -29,3 +29,55 @@ jobs:
version: context.ref
}
})
front-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: nextPackageInfo
name: Get `next` package info
run: |
cd packages/next
{
echo 'value<<EOF'
cat package.json
echo EOF
} >> "$GITHUB_OUTPUT"
- id: version
name: Extract `next` version
run: echo 'value=${{ fromJson(steps.nextPackageInfo.outputs.value).version }}' >> "$GITHUB_OUTPUT"
- name: Check token
run: gh auth status
env:
GITHUB_TOKEN: ${{ secrets.FRONT_TEST_TOKEN }}
- uses: actions/github-script@v7
name: Trigger vercel/front sync
id: trigger-front-sync
with:
retries: 3
retry-exempt-status-codes: 400,401,404
# Default github token cannot dispatch events to the remote repo, it should be
# a PAT with Actions write access (https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event)
github-token: ${{ secrets.FRONT_TEST_TOKEN }}
# Note `workflow_id` and `inputs` are contract between vercel/front,
# if these need to be changed both side should be updated accordingly.
script: |
await github.request(
"POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches",
{
owner: "vercel",
repo: "front",
workflow_id: "cron-update-next.yml",
ref: "main",
inputs: {
version: "${{ steps.version.outputs.value }}",
},
}
);
// Ideally we'd include a URL to this specific sync.
// However, creating a workflow_dispatch event does not produce an ID: https://github.com/orgs/community/discussions/9752
console.info(
"Sync started in https://github.com/vercel/front/actions/workflows/cron-update-next.yml?query=event%3Aworkflow_dispatch"
);
console.info(
"This may not start a new sync if one is already in progress. Check the logs of the cron-update-next Workflow run."
);
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export default withMDX(nextConfig)

This allows `.md` and `.mdx` files to act as pages, routes, or imports in your application.

## Add a `mdx-components.tsx` file
## Add an `mdx-components.tsx` file

Create a `mdx-components.tsx` (or `.js`) file in the root of your project to define global MDX Components. For example, at the same level as `pages` or `app`, or inside `src` if applicable.
Create an `mdx-components.tsx` (or `.js`) file in the root of your project to define global MDX Components. For example, at the same level as `pages` or `app`, or inside `src` if applicable.

```tsx filename="mdx-components.tsx" switcher
import type { MDXComponents } from 'mdx/types'
Expand Down
1 change: 1 addition & 0 deletions docs/02-app/02-api-reference/05-next-config-js/images.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export default function cloudfrontLoader({ src, width, quality }) {
url.searchParams.set('width', width.toString())
url.searchParams.set('quality', (quality || 75).toString())
return url.href
}
```

### Cloudinary
Expand Down
2 changes: 1 addition & 1 deletion docs/02-app/02-api-reference/06-create-next-app.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Further, you can negate default options by prefixing them with `--no-` (e.g. `--
See `create-next-app --help`:

```bash filename="Terminal"
Usage: create-next-app <project-directory> [options]
Usage: create-next-app [project-directory] [options]

Options:
-V, --version output the version number
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": "15.0.0-canary.53"
"version": "15.0.0-canary.54"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
"tree-kill": "1.2.2",
"tsec": "0.2.1",
"turbo": "2.0.6-canary.0",
"typescript": "5.4.5",
"typescript": "5.5.2",
"unfetch": "4.2.0",
"wait-port": "0.2.2",
"webpack": "5.90.0",
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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"keywords": [
"react",
"next",
Expand Down
4 changes: 3 additions & 1 deletion packages/create-next-app/templates/app-tw/js/app/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export const metadata = {
export default function RootLayout({ children }) {
return (
<html lang="en">
<body className={`${geistSans.variable} ${geistMono.variable}`}>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
</html>
Expand Down
4 changes: 3 additions & 1 deletion packages/create-next-app/templates/app-tw/ts/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<body className={`${geistSans.variable} ${geistMono.variable}`}>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
</html>
Expand Down
2 changes: 2 additions & 0 deletions packages/create-next-app/templates/app/js/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

* {
Expand Down
2 changes: 2 additions & 0 deletions packages/create-next-app/templates/app/ts/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

* {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default function Document() {
return (
<Html lang="en">
<Head />
<body>
<body className="antialiased">
<Main />
<NextScript />
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default function Document() {
return (
<Html lang="en">
<Head />
<body>
<body className="antialiased">
<Main />
<NextScript />
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

* {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

* {
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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"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": "15.0.0-canary.53",
"@next/eslint-plugin-next": "15.0.0-canary.54",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || 7.0.0 - 7.2.0",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || 7.0.0 - 7.2.0",
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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ yarn add @next/mdx

## Usage

Create a `mdx-components.js` file at the root of your project with the following contents:
Create an `mdx-components.js` file at the root of your project with the following contents:

```js
// This file is required to use @next/mdx in the `app` directory.
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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"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": "15.0.0-canary.53",
"version": "15.0.0-canary.54",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
28 changes: 17 additions & 11 deletions packages/next-swc/crates/next-core/src/next_server/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ use crate::{
get_decorators_transform_options, get_jsx_transform_options,
get_typescript_transform_options,
},
util::{foreign_code_context_condition, load_next_js_templateon, NextRuntime},
util::{
foreign_code_context_condition, get_transpiled_packages, load_next_js_templateon,
NextRuntime,
},
};

#[turbo_tasks::value(serialization = "auto_for_input")]
Expand Down Expand Up @@ -140,23 +143,26 @@ pub async fn get_server_resolve_options_context(
let invalid_styled_jsx_client_only_resolve_plugin =
get_invalid_styled_jsx_resolve_plugin(project_path);

let mut transpile_packages = next_config.transpile_packages().await?.clone_value();
transpile_packages.extend(
(*next_config.optimize_package_imports().await?)
.iter()
.cloned(),
);

// Always load these predefined packages as external.
let mut external_packages: Vec<RcStr> = load_next_js_templateon(
project_path,
"dist/lib/server-external-packages.json".into(),
)
.await?;

let mut transpiled_packages = get_transpiled_packages(next_config, project_path)
.await?
.clone_value();

transpiled_packages.extend(
(*next_config.optimize_package_imports().await?)
.iter()
.cloned(),
);

let server_external_packages = &*next_config.server_external_packages().await?;

let conflicting_packages = transpile_packages
let conflicting_packages = transpiled_packages
.iter()
.filter(|package| server_external_packages.contains(package))
.collect::<Vec<_>>();
Expand All @@ -172,7 +178,7 @@ pub async fn get_server_resolve_options_context(
// Add the config's own list of external packages.
external_packages.extend(server_external_packages.iter().cloned());

external_packages.retain(|item| !transpile_packages.contains(item));
external_packages.retain(|item| !transpiled_packages.contains(item));

let ty = ty.into_value();

Expand Down Expand Up @@ -203,7 +209,7 @@ pub async fn get_server_resolve_options_context(
ExternalCjsModulesResolvePlugin::new(
project_path,
project_path.root(),
ExternalPredicate::AllExcept(Vc::cell(transpile_packages)).cell(),
ExternalPredicate::AllExcept(Vc::cell(transpiled_packages)).cell(),
*next_config.import_externals().await?,
)
};
Expand Down
Loading

0 comments on commit 83d55ed

Please sign in to comment.