Skip to content

Commit

Permalink
Merge branch 'canary' into JanKaifer-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Dec 19, 2022
2 parents cc54d8d + ae5502e commit fd173ea
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 79 deletions.
3 changes: 1 addition & 2 deletions docs/api-reference/data-fetching/get-static-props.md
Expand Up @@ -233,8 +233,7 @@ export const getStaticProps: GetStaticProps<{ posts: Post[] }> = async (
If you want to get inferred typings for your props, you can use `InferGetStaticPropsType<typeof getStaticProps>`:

```tsx
import { InferGetStaticPropsType } from 'next'
import { GetStaticProps } from 'next'
import type { InferGetStaticPropsType, GetStaticProps } from 'next'

type Post = {
author: string
Expand Down
18 changes: 11 additions & 7 deletions packages/next/build/webpack/plugins/flight-client-entry-plugin.ts
Expand Up @@ -345,14 +345,18 @@ export class FlightClientEntryPlugin {
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH,
},
(assets: webpack.Compilation['assets']) => {
const manifest = JSON.stringify({
...serverCSSManifest,
...edgeServerCSSManifest,
__entry_css__: {
...serverCSSManifest.__entry_css__,
...edgeServerCSSManifest.__entry_css__,
const manifest = JSON.stringify(
{
...serverCSSManifest,
...edgeServerCSSManifest,
__entry_css__: {
...serverCSSManifest.__entry_css__,
...edgeServerCSSManifest.__entry_css__,
},
},
})
null,
this.dev ? 2 : undefined
)
assets[FLIGHT_SERVER_CSS_MANIFEST + '.json'] = new sources.RawSource(
manifest
) as unknown as webpack.sources.RawSource
Expand Down
6 changes: 4 additions & 2 deletions packages/next/build/webpack/plugins/flight-manifest-plugin.ts
Expand Up @@ -191,7 +191,9 @@ export class FlightManifestPlugin {
ssrNamedModuleId = `./${ssrNamedModuleId.replace(/\\/g, '/')}`

if (isCSSModule) {
const chunks = [...chunk.files].filter((f) => f.endsWith('.css'))
const chunks = [...chunk.files].filter(
(f) => !f.startsWith('static/css/pages/') && f.endsWith('.css')
)
if (!manifest[resource]) {
manifest[resource] = {
default: {
Expand Down Expand Up @@ -350,7 +352,7 @@ export class FlightManifestPlugin {
})

const file = 'server/' + FLIGHT_MANIFEST
const json = JSON.stringify(manifest)
const json = JSON.stringify(manifest, null, this.dev ? 2 : undefined)

ASYNC_CLIENT_MODULES.clear()

Expand Down
7 changes: 0 additions & 7 deletions test/e2e/app-dir/app-alias.test.ts
Expand Up @@ -5,13 +5,6 @@ createNextDescribe(
'app-dir alias handling',
{
files: path.join(__dirname, 'app-alias'),
dependencies: {
react: 'latest',
'react-dom': 'latest',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
},
packageJson: {
type: 'module',
},
Expand Down
7 changes: 0 additions & 7 deletions test/e2e/app-dir/app-edge-global.test.ts
Expand Up @@ -5,13 +5,6 @@ createNextDescribe(
'app-dir global edge configuration',
{
files: path.join(__dirname, 'app-edge-global'),
dependencies: {
react: 'latest',
'react-dom': 'latest',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
},
skipDeployment: true,
},
({ next }) => {
Expand Down
7 changes: 0 additions & 7 deletions test/e2e/app-dir/app-edge.test.ts
Expand Up @@ -6,13 +6,6 @@ createNextDescribe(
'app-dir edge SSR',
{
files: path.join(__dirname, 'app-edge'),
dependencies: {
react: 'latest',
'react-dom': 'latest',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
},
skipDeployment: true,
},
({ next }) => {
Expand Down
7 changes: 0 additions & 7 deletions test/e2e/app-dir/create-root-layout.test.ts
Expand Up @@ -218,13 +218,6 @@ describe('app-dir create root layout', () => {
path.join(__dirname, 'create-root-layout/next.config.js')
),
},
dependencies: {
react: 'latest',
'react-dom': 'latest',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
},
})
})
afterAll(() => next.destroy())
Expand Down
7 changes: 0 additions & 7 deletions test/e2e/app-dir/import.test.ts
Expand Up @@ -5,13 +5,6 @@ createNextDescribe(
'app dir imports',
{
files: path.join(__dirname, 'import'),
dependencies: {
react: 'latest',
'react-dom': 'latest',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
},
},
({ next }) => {
;['js', 'jsx', 'ts', 'tsx'].forEach((ext) => {
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/app-dir/index.test.ts
Expand Up @@ -1315,6 +1315,11 @@ createNextDescribe(
).toBe('rgb(0, 0, 255)')
})

it('should not contain pages css in app dir page', async () => {
const html = await next.render('/css/css-page')
expect(html).not.toContain('/pages/_app.css')
})

if (!isDev) {
it('should not include unused css modules in the page in prod', async () => {
const browser = await next.browser('/css/css-page/unused')
Expand Down
7 changes: 0 additions & 7 deletions test/e2e/app-dir/layout-params.test.ts
Expand Up @@ -5,13 +5,6 @@ createNextDescribe(
'app dir - layout params',
{
files: path.join(__dirname, './layout-params'),
dependencies: {
react: 'latest',
'react-dom': 'latest',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
},
},
({ next }) => {
describe('basic params', () => {
Expand Down
Expand Up @@ -9,13 +9,6 @@ describe('app-dir navigation and querystring', () => {
beforeAll(async () => {
next = await createNext({
files: new FileRef(__dirname),
dependencies: {
react: 'latest',
'react-dom': 'latest',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
},
})
})
afterAll(() => next.destroy())
Expand Down
Expand Up @@ -9,13 +9,6 @@ describe('useSelectedLayoutSegment(s)', () => {
beforeAll(async () => {
next = await createNext({
files: new FileRef(__dirname),
dependencies: {
react: 'latest',
'react-dom': 'latest',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
},
})
})
afterAll(() => next.destroy())
Expand Down
5 changes: 0 additions & 5 deletions test/e2e/new-link-behavior/typescript.test.ts
Expand Up @@ -17,11 +17,6 @@ describe('New Link Behavior', () => {
'tsconfig.json': new FileRef(path.join(appDir, 'tsconfig.json')),
'next.config.js': new FileRef(path.join(appDir, 'next.config.js')),
},
dependencies: {
typescript: '*',
'@types/react': '*',
'@types/node': '*',
},
})
})
afterAll(() => next.destroy())
Expand Down
9 changes: 2 additions & 7 deletions test/e2e/test-utils-tests/basic/basic.test.ts
@@ -1,4 +1,4 @@
import { createNext, FileRef } from 'e2e-utils'
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { fetchViaHTTP } from 'next-test-utils'

Expand All @@ -7,12 +7,7 @@ describe('createNext', () => {

beforeAll(async () => {
next = await createNext({
files: new FileRef(__dirname),
dependencies: {
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
},
files: __dirname,
})
})
afterAll(() => next.destroy())
Expand Down
3 changes: 3 additions & 0 deletions test/lib/next-modes/base.ts
Expand Up @@ -129,6 +129,9 @@ export class NextInstance {
const finalDependencies = {
react: reactVersion,
'react-dom': reactVersion,
'@types/react': reactVersion,
typescript: 'latest',
'@types/node': 'latest',
...this.dependencies,
...this.packageJson?.dependencies,
}
Expand Down
3 changes: 3 additions & 0 deletions test/production/ci-missing-typescript-deps/index.test.ts
Expand Up @@ -14,6 +14,9 @@ describe('ci-missing-typescript-deps', () => {
CI: '1',
},
skipStart: true,
dependencies: {
typescript: undefined,
},
})
try {
let error
Expand Down

0 comments on commit fd173ea

Please sign in to comment.