Skip to content

Commit

Permalink
Merge branch 'canary' into fix/tw-styles
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Mar 19, 2023
2 parents beb00e8 + 20b8dda commit 2c82cf1
Show file tree
Hide file tree
Showing 117 changed files with 2,211 additions and 1,236 deletions.
6 changes: 4 additions & 2 deletions docs/advanced-features/static-html-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ description: Export your Next.js app to static HTML, and run it standalone witho
</ul>
</details>

`next export` allows you to export your Next.js application to static HTML, which can render without the need of a Node.js server. It is recommended to only use `next export` if you don't need any of the [unsupported features](#unsupported-features) requiring a server.
Next.js can be used to generate static applications, including using React in the browser without the need for a Node.js server.

If you're looking to build a hybrid site where only _some_ pages are prerendered to static HTML, Next.js already does that automatically. Learn more about [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md) and [Incremental Static Regeneration](/docs/basic-features/data-fetching/incremental-static-regeneration.md).
The core of Next.js has been designed to enable starting as a static site (or Single-Page Application), if desired, and later upgrade to use powerful, dynamic features that require a server. For example, [Incremental Static Regeneration](/docs/basic-features/data-fetching/incremental-static-regeneration.md), [Internationalized Routing](/docs/advanced-features/i18n-routing.md), [and more](#unsupported-features).

Since Next.js supports this static export, it can be deployed and hosted on any web server that can serve HTML/CSS/JS static assets.

## `next export`

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.2.5-canary.6"
"version": "13.2.5-canary.8"
}
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.2.5-canary.6",
"version": "13.2.5-canary.8",
"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.2.5-canary.6",
"version": "13.2.5-canary.8",
"description": "ESLint configuration used by NextJS.",
"main": "index.js",
"license": "MIT",
Expand All @@ -12,7 +12,7 @@
"test-pack": "cd ../../ && pnpm test-pack eslint-config-next"
},
"dependencies": {
"@next/eslint-plugin-next": "13.2.5-canary.6",
"@next/eslint-plugin-next": "13.2.5-canary.8",
"@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.2.5-canary.6",
"version": "13.2.5-canary.8",
"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.2.5-canary.6",
"version": "13.2.5-canary.8",
"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.2.5-canary.6",
"version": "13.2.5-canary.8",
"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.2.5-canary.6",
"version": "13.2.5-canary.8",
"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": "13.2.5-canary.6",
"version": "13.2.5-canary.8",
"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.2.5-canary.6",
"version": "13.2.5-canary.8",
"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.2.5-canary.6",
"version": "13.2.5-canary.8",
"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.2.5-canary.6",
"version": "13.2.5-canary.8",
"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.2.5-canary.6",
"version": "13.2.5-canary.8",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
70 changes: 49 additions & 21 deletions packages/next-swc/crates/next-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::{
sync::Arc,
time::{Duration, Instant},
};
use turbo_tasks::UpdateInfo;

use anyhow::{Context, Result};
use devserver_options::DevServerOptions;
Expand Down Expand Up @@ -239,7 +240,7 @@ impl NextDevServerBuilder {
#[turbo_tasks::function]
async fn project_fs(project_dir: &str) -> Result<FileSystemVc> {
let disk_fs = DiskFileSystemVc::new("project".to_string(), project_dir.to_string());
disk_fs.await?.start_watching()?;
disk_fs.await?.start_watching_with_invalidation_reason()?;
Ok(disk_fs.into())
}

Expand Down Expand Up @@ -470,14 +471,14 @@ pub async fn start_server(options: &DevServerOptions) -> Result<()> {
let stats_future = async move {
if options.log_detail {
println!(
"{event_type} - initial compilation {start} ({memory})",
"{event_type} - startup {start} ({memory})",
event_type = "event".purple(),
start = FormatDuration(start.elapsed()),
memory = FormatBytes(TurboMalloc::memory_usage())
);
} else {
println!(
"{event_type} - initial compilation {start}",
"{event_type} - startup {start}",
event_type = "event".purple(),
start = FormatDuration(start.elapsed()),
);
Expand All @@ -487,37 +488,64 @@ pub async fn start_server(options: &DevServerOptions) -> Result<()> {
loop {
let update_future = profile_timeout(
tt_clone.as_ref(),
tt_clone.update_info(Duration::from_millis(100), Duration::MAX),
tt_clone.aggregated_update_info(Duration::from_millis(100), Duration::MAX),
);

if let Some((elapsed, count)) = update_future.await {
if let Some(UpdateInfo {
duration: elapsed,
tasks: count,
reasons,
..
}) = update_future.await
{
progress_counter = 0;
if options.log_detail {
println!(
"\x1b[2K{event_type} - updated in {elapsed} ({tasks} tasks, {memory})",
event_type = "event".purple(),
elapsed = FormatDuration(elapsed),
tasks = count,
memory = FormatBytes(TurboMalloc::memory_usage())
);
} else {
println!(
"\x1b[2K{event_type} - updated in {elapsed}",
event_type = "event".purple(),
elapsed = FormatDuration(elapsed),
);
match (options.log_detail, !reasons.is_empty()) {
(true, true) => {
println!(
"\x1b[2K{event_type} - {reasons} {elapsed} ({tasks} tasks, {memory})",
event_type = "event".purple(),
elapsed = FormatDuration(elapsed),
tasks = count,
memory = FormatBytes(TurboMalloc::memory_usage())
);
}
(true, false) => {
println!(
"\x1b[2K{event_type} - compilation {elapsed} ({tasks} tasks, {memory})",
event_type = "event".purple(),
elapsed = FormatDuration(elapsed),
tasks = count,
memory = FormatBytes(TurboMalloc::memory_usage())
);
}
(false, true) => {
println!(
"\x1b[2K{event_type} - {reasons} {elapsed}",
event_type = "event".purple(),
elapsed = FormatDuration(elapsed),
);
}
(false, false) => {
if elapsed > Duration::from_secs(1) {
println!(
"\x1b[2K{event_type} - compilation {elapsed}",
event_type = "event".purple(),
elapsed = FormatDuration(elapsed),
);
}
}
}
} else {
progress_counter += 1;
if options.log_detail {
print!(
"\x1b[2K{event_type} - updating for {progress_counter}s... ({memory})\r",
"\x1b[2K{event_type} - {progress_counter}s... ({memory})\r",
event_type = "event".purple(),
memory = FormatBytes(TurboMalloc::memory_usage())
);
} else {
print!(
"\x1b[2K{event_type} - updating for {progress_counter}s...\r",
"\x1b[2K{event_type} - {progress_counter}s...\r",
event_type = "event".purple(),
);
}
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.2.5-canary.6",
"version": "13.2.5-canary.8",
"private": true,
"scripts": {
"clean": "rm -rf ./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.2.5-canary.6",
"version": "13.2.5-canary.8",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -80,7 +80,7 @@
]
},
"dependencies": {
"@next/env": "13.2.5-canary.6",
"@next/env": "13.2.5-canary.8",
"@swc/helpers": "0.4.14",
"caniuse-lite": "^1.0.30001406",
"postcss": "8.4.14",
Expand Down Expand Up @@ -135,11 +135,11 @@
"@hapi/accept": "5.0.2",
"@napi-rs/cli": "2.14.7",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.2.5-canary.6",
"@next/polyfill-nomodule": "13.2.5-canary.6",
"@next/react-dev-overlay": "13.2.5-canary.6",
"@next/react-refresh-utils": "13.2.5-canary.6",
"@next/swc": "13.2.5-canary.6",
"@next/polyfill-module": "13.2.5-canary.8",
"@next/polyfill-nomodule": "13.2.5-canary.8",
"@next/react-dev-overlay": "13.2.5-canary.8",
"@next/react-refresh-utils": "13.2.5-canary.8",
"@next/swc": "13.2.5-canary.8",
"@opentelemetry/api": "1.4.1",
"@segment/ajv-human-errors": "2.1.2",
"@taskr/clear": "1.1.0",
Expand Down
8 changes: 8 additions & 0 deletions packages/next/src/build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,15 @@ const server = http.createServer(async (req, res) => {
})
const currentPort = parseInt(process.env.PORT, 10) || 3000
const hostname = process.env.HOSTNAME || 'localhost'
const keepAliveTimeout = parseInt(process.env.KEEP_ALIVE_TIMEOUT, 10);
if (
!Number.isNaN(keepAliveTimeout) &&
Number.isFinite(keepAliveTimeout) &&
keepAliveTimeout >= 0
) {
server.keepAliveTimeout = keepAliveTimeout
}
server.listen(currentPort, (err) => {
if (err) {
console.error("Failed to start server", err)
Expand Down
12 changes: 8 additions & 4 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { finalizeEntrypoint } from './entries'
import * as Log from './output/log'
import { buildConfiguration } from './webpack/config'
import MiddlewarePlugin, {
getEdgePolyfilledModules,
handleWebpackExternalForEdgeRuntime,
} from './webpack/plugins/middleware-plugin'
import BuildManifestPlugin from './webpack/plugins/build-manifest-plugin'
Expand Down Expand Up @@ -687,7 +688,7 @@ export default async function getBaseWebpackConfig(
if (isClient) {
if (isEdgeRuntime(config.experimental.runtime)) {
Log.warn(
'You ase using `experimental.runtime` which was removed. Check https://nextjs.org/docs/api-routes/edge-api-routes on how to use edge runtime.'
'You are using `experimental.runtime` which was removed. Check https://nextjs.org/docs/api-routes/edge-api-routes on how to use edge runtime.'
)
}
}
Expand Down Expand Up @@ -1460,6 +1461,7 @@ export default async function getBaseWebpackConfig(
'./cjs/react-dom-server-legacy.browser.development.js':
'{}',
},
getEdgePolyfilledModules(),
handleWebpackExternalForEdgeRuntime,
]
: []),
Expand Down Expand Up @@ -1915,18 +1917,20 @@ export default async function getBaseWebpackConfig(
use: swcLoaderForServerLayer,
},
{
test: codeCondition.test,
...codeCondition,
issuerLayer: {
or: [WEBPACK_LAYERS.client, WEBPACK_LAYERS.appClient],
},
exclude: [staticGenerationAsyncStorageRegex],
exclude: [
staticGenerationAsyncStorageRegex,
codeCondition.exclude,
],
use: [
...(dev && isClient
? [
require.resolve(
'next/dist/compiled/@next/react-refresh-utils/dist/loader'
),
defaultLoaders.babel,
]
: []),
{
Expand Down

0 comments on commit 2c82cf1

Please sign in to comment.