Skip to content

Commit

Permalink
Merge branch 'canary' into fix-set-cookie-header
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Oct 28, 2021
2 parents dae9a97 + 5b4ad4a commit 40f729e
Show file tree
Hide file tree
Showing 23 changed files with 57 additions and 69 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "12.0.2-canary.5"
"version": "12.0.2-canary.6"
}
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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"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": "12.0.2-canary.5",
"@next/eslint-plugin-next": "12.0.2-canary.6",
"@rushstack/eslint-patch": "^1.0.6",
"@typescript-eslint/parser": "^4.20.0",
"eslint-import-resolver-node": "^0.3.4",
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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"main": "index.js",
"license": "MIT",
"repository": {
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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
10 changes: 5 additions & 5 deletions packages/next/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ export default async function build(
setGlobal('phase', PHASE_PRODUCTION_BUILD)
setGlobal('distDir', distDir)

const webServerRuntime = !!config.experimental.concurrentFeatures
const hasConcurrentFeatures = !!config.experimental.concurrentFeatures
const hasServerComponents =
webServerRuntime && !!config.experimental.serverComponents
hasConcurrentFeatures && !!config.experimental.serverComponents

const { target } = config
const buildId: string = await nextBuildSpan
Expand Down Expand Up @@ -593,7 +593,7 @@ export default async function build(
rewrites,
runWebpackSpan,
}),
webServerRuntime
hasConcurrentFeatures
? getBaseWebpackConfig(dir, {
buildId,
reactProductionProfiling,
Expand Down Expand Up @@ -904,7 +904,7 @@ export default async function build(
if (
!isMiddlewareRoute &&
!page.match(RESERVED_PAGE) &&
!webServerRuntime
!hasConcurrentFeatures
) {
try {
let isPageStaticSpan =
Expand Down Expand Up @@ -1014,7 +1014,7 @@ export default async function build(
static: isStatic,
isSsg,
isWebSsr:
webServerRuntime &&
hasConcurrentFeatures &&
!isMiddlewareRoute &&
!page.match(RESERVED_PAGE),
isHybridAmp,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ export default async function getBaseWebpackConfig(
new PagesManifestPlugin({ serverless: isLikeServerless, dev }),
// MiddlewarePlugin should be after DefinePlugin so NEXT_PUBLIC_*
// replacement is done before its process.env.* handling
!isServer && new MiddlewarePlugin({ dev, hasServerComponents }),
!isServer && new MiddlewarePlugin({ dev }),
isServer && new NextJsSsrImportPlugin(),
!isServer &&
new BuildManifestPlugin({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default async function transformSource(
this.loadModule
)

// next.js/packages/next/link.js
// next.js/packages/next/<component>.js
if (/[\\/]next[\\/](link|image)\.js$/.test(url)) {
names.push('default')
}
Expand Down
12 changes: 2 additions & 10 deletions packages/next/build/webpack/plugins/middleware-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,9 @@ export interface MiddlewareManifest {

export default class MiddlewarePlugin {
dev: boolean
hasServerComponents?: boolean

constructor({
dev,
hasServerComponents,
}: {
dev: boolean
hasServerComponents?: boolean
}) {

constructor({ dev }: { dev: boolean }) {
this.dev = dev
this.hasServerComponents = hasServerComponents
}

createAssets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,7 @@ export class TerserPlugin {
const pluginName = this.constructor.name
const availableNumberOfCores = this.options.parallel

compiler.hooks.compilation.tap(pluginName, (compilation) => {
// Don't run minifier against mini-css-extract-plugin
if (
compilation.name !== 'client' &&
compilation.name !== 'server' &&
compilation.name !== 'server-web'
) {
return
}

compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
const cache = compilation.getCache('TerserWebpackPlugin')

const handleHashForChunk = (hash, chunk) => {
Expand Down
12 changes: 6 additions & 6 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -67,10 +67,10 @@
"dependencies": {
"@babel/runtime": "7.15.4",
"@hapi/accept": "5.0.2",
"@next/env": "12.0.2-canary.5",
"@next/polyfill-module": "12.0.2-canary.5",
"@next/react-dev-overlay": "12.0.2-canary.5",
"@next/react-refresh-utils": "12.0.2-canary.5",
"@next/env": "12.0.2-canary.6",
"@next/polyfill-module": "12.0.2-canary.6",
"@next/react-dev-overlay": "12.0.2-canary.6",
"@next/react-refresh-utils": "12.0.2-canary.6",
"@node-rs/helper": "1.2.1",
"acorn": "8.5.0",
"assert": "2.0.0",
Expand Down Expand Up @@ -154,7 +154,7 @@
"@babel/traverse": "7.15.0",
"@babel/types": "7.15.0",
"@napi-rs/cli": "1.1.0",
"@next/polyfill-nomodule": "12.0.2-canary.5",
"@next/polyfill-nomodule": "12.0.2-canary.6",
"@peculiar/webcrypto": "1.1.7",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
Expand Down
31 changes: 13 additions & 18 deletions packages/next/server/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1193,25 +1193,20 @@ export async function renderToHTML(
)
}
: null,
renderOpts.optimizeCss
!process.browser && renderOpts.optimizeCss
? async (html: string) => {
if (process.browser) {
// Have to disable critters under the web environment.
return html
} else {
// eslint-disable-next-line import/no-extraneous-dependencies
const Critters = require('critters')
const cssOptimizer = new Critters({
ssrMode: true,
reduceInlineStyles: false,
path: renderOpts.distDir,
publicPath: `${renderOpts.assetPrefix}/_next/`,
preload: 'media',
fonts: false,
...renderOpts.optimizeCss,
})
return await cssOptimizer.process(html)
}
// eslint-disable-next-line import/no-extraneous-dependencies
const Critters = require('critters')
const cssOptimizer = new Critters({
ssrMode: true,
reduceInlineStyles: false,
path: renderOpts.distDir,
publicPath: `${renderOpts.assetPrefix}/_next/`,
preload: 'media',
fonts: false,
...renderOpts.optimizeCss,
})
return await cssOptimizer.process(html)
}
: null,
inAmpMode || hybridAmp
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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"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": "12.0.2-canary.5",
"version": "12.0.2-canary.6",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
12 changes: 11 additions & 1 deletion scripts/publish-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const cwd = process.cwd()
let platforms = (await readdir(nativePackagesDir)).filter(
(name) => !name.startsWith('.')
)
const publishedPkgs = new Set()
// TODO: update to latest version where all pacakges were
// successfully published
const fallbackVersion = `12.0.1`

for (let platform of platforms) {
try {
let binaryName = `next-swc.${platform}.node`
Expand All @@ -42,6 +47,7 @@ const cwd = process.cwd()
gitref.includes('canary') ? ' --tag canary' : ''
}`
)
publishedPkgs.add(platform)
} catch (err) {
// don't block publishing other versions on single platform error
console.error(`Failed to publish`, platform, err)
Expand All @@ -62,7 +68,11 @@ const cwd = process.cwd()
)
for (let platform of platforms) {
let optionalDependencies = nextPkg.optionalDependencies || {}
optionalDependencies['@next/swc-' + platform] = version
optionalDependencies['@next/swc-' + platform] = publishedPkgs.has(
platform
)
? version
: fallbackVersion
nextPkg.optionalDependencies = optionalDependencies
}
await writeFile(
Expand Down
2 changes: 1 addition & 1 deletion test/integration/react-18/app/components/dynamic-hello.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import dynamic from 'next/dynamic'
let ssr
const suspense = false

const Hello = dynamic(() => import('./hello'), {
const Hello = dynamic(() => import(/* webpackMode: "eager" */ './hello'), {
ssr,
suspense,
})
Expand Down
4 changes: 2 additions & 2 deletions test/integration/react-18/test/concurrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default (context, _render) => {
})
})

it.skip('should resolve suspense on server side if not suspended on server', async () => {
it('should resolve suspense on server side if not suspended on server', async () => {
await withBrowser('/suspense/no-thrown', async (browser) => {
await check(
() => browser.waitForElementByCss('#server-rendered').text(),
Expand All @@ -39,7 +39,7 @@ export default (context, _render) => {
})
})

it.skip('should resolve suspense on server side if suspended on server', async () => {
it('should resolve suspense on server side if suspended on server', async () => {
await withBrowser('/suspense/thrown', async (browser) => {
await check(
() => browser.waitForElementByCss('#server-rendered').text(),
Expand Down

0 comments on commit 40f729e

Please sign in to comment.