From 729948e6c1841c337a32e9a2b28476f6649b1ada Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 20 Jan 2024 13:56:36 +0800 Subject: [PATCH] fix(deps): update dependency next to v14 (#1177) * fix(deps): update dependency next to v14 * fix(nextjs): rectify antd-related modularize imports See vercel/next.js#40183 and vercel/next.js#58817. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: sabertazimi --- jest.config.js | 43 +++++++------------ next.config.js | 11 +++++ package.json | 2 +- yarn.lock | 111 ++++++++++++++++++++++++++----------------------- 4 files changed, 85 insertions(+), 82 deletions(-) diff --git a/jest.config.js b/jest.config.js index 1927720e7..9faabd4c7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,7 +2,16 @@ const { pathsToModuleNameMapper } = require('ts-jest'); const { compilerOptions } = require('./tsconfig.json'); const nextJest = require('next/jest'); -/** @type {import('ts-jest').InitialOptionsTsJest} */ +const createJestConfig = nextJest({ + dir: './', +}); + +// Custom `moduleNameMapper` configuration +const paths = pathsToModuleNameMapper(compilerOptions.paths, { + prefix: '/', +}); + +/** @type {import('ts-jest').JestConfigWithTsJest} */ const customJestConfig = { collectCoverage: true, coverageDirectory: 'coverage', @@ -24,36 +33,12 @@ const customJestConfig = { '!**/Header.tsx', ], moduleDirectories: ['node_modules', '/'], + moduleNameMapper: { + ...paths, + }, setupFilesAfterEnv: ['/jest.setup.js'], testEnvironment: 'jest-environment-jsdom', testPathIgnorePatterns: ['/cypress/'], }; -const createJestConfig = nextJest({ - dir: './', -})(customJestConfig); - -module.exports = async () => { - // Create Next.js jest configuration presets - const jestConfig = await createJestConfig(); - - // Custom `moduleNameMapper` configuration - const paths = pathsToModuleNameMapper(compilerOptions.paths, { - prefix: '/', - }); - const moduleNameMapper = { - ...jestConfig.moduleNameMapper, - ...paths, - }; - - // Custom `transformIgnorePatterns` configuration - const transformIgnorePatterns = [ - // Transform ESM-only modules in `node_modules`. - '/node_modules/(?!next-mdx-remote|@mdx-js|@react-hook)', - ...jestConfig.transformIgnorePatterns.filter( - pattern => pattern !== '/node_modules/' - ), - ]; - - return { ...jestConfig, moduleNameMapper, transformIgnorePatterns }; -}; +module.exports = createJestConfig(customJestConfig); diff --git a/next.config.js b/next.config.js index fcab0180f..4727380f1 100644 --- a/next.config.js +++ b/next.config.js @@ -16,6 +16,17 @@ const nextConfig = { }, reactStrictMode: true, swcMinify: isProduction, + transpilePackages: [ + // @see https://github.com/vercel/next.js/issues/40183 + // @see https://github.com/vercel/next.js/issues/58817 + '@ant-design', + '@mdx-js', + '@react-hook', + 'next-mdx-remote', + 'rc-pagination', + 'rc-picker', + 'rc-util', + ], }; module.exports = NextPwa(nextConfig); diff --git a/package.json b/package.json index 4558453f3..5db4f8049 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "framer-motion": "^10.18.0", "gray-matter": "^4.0.3", "katex": "^0.16.9", - "next": "^13.5.6", + "next": "^14.1.0", "next-mdx-remote": "^4.4.1", "next-progress": "^2.3.1", "next-pwa": "^5.6.0", diff --git a/yarn.lock b/yarn.lock index 89e2f0aa7..f87d4e033 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2654,7 +2654,14 @@ __metadata: languageName: node linkType: hard -"@next/env@npm:13.5.6, @next/env@npm:^13.4.3": +"@next/env@npm:14.1.0": + version: 14.1.0 + resolution: "@next/env@npm:14.1.0" + checksum: f45ce1e3dad87cdbddc58b06bd411f44a6d21dfc2c344d02a5e1b07f56fbc9a39e192c0b0917df9f2e9e4e2156306a8c78f173ca4b53932c2793e67797462a23 + languageName: node + linkType: hard + +"@next/env@npm:^13.4.3": version: 13.5.6 resolution: "@next/env@npm:13.5.6" checksum: b1fefa21b698397a2f922ee53a5ecb91ff858f042b2a198652b9de49c031fc5e00d79da92ba7d84ef205e95368d5afbb0f104abaf00e9dde7985d9eae63bb4fb @@ -2670,65 +2677,65 @@ __metadata: languageName: node linkType: hard -"@next/swc-darwin-arm64@npm:13.5.6": - version: 13.5.6 - resolution: "@next/swc-darwin-arm64@npm:13.5.6" +"@next/swc-darwin-arm64@npm:14.1.0": + version: 14.1.0 + resolution: "@next/swc-darwin-arm64@npm:14.1.0" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@next/swc-darwin-x64@npm:13.5.6": - version: 13.5.6 - resolution: "@next/swc-darwin-x64@npm:13.5.6" +"@next/swc-darwin-x64@npm:14.1.0": + version: 14.1.0 + resolution: "@next/swc-darwin-x64@npm:14.1.0" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@next/swc-linux-arm64-gnu@npm:13.5.6": - version: 13.5.6 - resolution: "@next/swc-linux-arm64-gnu@npm:13.5.6" +"@next/swc-linux-arm64-gnu@npm:14.1.0": + version: 14.1.0 + resolution: "@next/swc-linux-arm64-gnu@npm:14.1.0" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-arm64-musl@npm:13.5.6": - version: 13.5.6 - resolution: "@next/swc-linux-arm64-musl@npm:13.5.6" +"@next/swc-linux-arm64-musl@npm:14.1.0": + version: 14.1.0 + resolution: "@next/swc-linux-arm64-musl@npm:14.1.0" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@next/swc-linux-x64-gnu@npm:13.5.6": - version: 13.5.6 - resolution: "@next/swc-linux-x64-gnu@npm:13.5.6" +"@next/swc-linux-x64-gnu@npm:14.1.0": + version: 14.1.0 + resolution: "@next/swc-linux-x64-gnu@npm:14.1.0" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-x64-musl@npm:13.5.6": - version: 13.5.6 - resolution: "@next/swc-linux-x64-musl@npm:13.5.6" +"@next/swc-linux-x64-musl@npm:14.1.0": + version: 14.1.0 + resolution: "@next/swc-linux-x64-musl@npm:14.1.0" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@next/swc-win32-arm64-msvc@npm:13.5.6": - version: 13.5.6 - resolution: "@next/swc-win32-arm64-msvc@npm:13.5.6" +"@next/swc-win32-arm64-msvc@npm:14.1.0": + version: 14.1.0 + resolution: "@next/swc-win32-arm64-msvc@npm:14.1.0" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@next/swc-win32-ia32-msvc@npm:13.5.6": - version: 13.5.6 - resolution: "@next/swc-win32-ia32-msvc@npm:13.5.6" +"@next/swc-win32-ia32-msvc@npm:14.1.0": + version: 14.1.0 + resolution: "@next/swc-win32-ia32-msvc@npm:14.1.0" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@next/swc-win32-x64-msvc@npm:13.5.6": - version: 13.5.6 - resolution: "@next/swc-win32-x64-msvc@npm:13.5.6" +"@next/swc-win32-x64-msvc@npm:14.1.0": + version: 14.1.0 + resolution: "@next/swc-win32-x64-msvc@npm:14.1.0" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -3137,7 +3144,7 @@ __metadata: jest-axe: "npm:^8.0.0" jest-environment-jsdom: "npm:^29.7.0" katex: "npm:^0.16.9" - next: "npm:^13.5.6" + next: "npm:^14.1.0" next-mdx-remote: "npm:^4.4.1" next-progress: "npm:^2.3.1" next-pwa: "npm:^5.6.0" @@ -4991,10 +4998,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30001406, caniuse-lite@npm:^1.0.30001538, caniuse-lite@npm:^1.0.30001565": - version: 1.0.30001571 - resolution: "caniuse-lite@npm:1.0.30001571" - checksum: 632f476e39febbfb5dc91c236981f3d518dc0cf55c42cc2bba431a6b6f4cceae3f9cd74d26312f30e9de65a3cc92ccf80d964ba8de061e25f37b7f0518303dad +"caniuse-lite@npm:^1.0.30001538, caniuse-lite@npm:^1.0.30001565, caniuse-lite@npm:^1.0.30001579": + version: 1.0.30001579 + resolution: "caniuse-lite@npm:1.0.30001579" + checksum: 4003970f8d01a5fa314e39f4a21751dc750a530f3d19aed225e18e8e02892b590b8b0debfa0961eae9bc0e49b77bfb17cf30d2469540e428a8305e3cc9164fb8 languageName: node linkType: hard @@ -7985,7 +7992,7 @@ __metadata: languageName: node linkType: hard -"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": +"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.11, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": version: 4.2.11 resolution: "graceful-fs@npm:4.2.11" checksum: 386d011a553e02bc594ac2ca0bd6d9e4c22d7fa8cfbfc448a6d148c59ea881b092db9dbe3547ae4b88e55f1b01f7c4a2ecc53b310c042793e63aa44cf6c257f2 @@ -11576,26 +11583,26 @@ __metadata: languageName: node linkType: hard -"next@npm:^13.5.6": - version: 13.5.6 - resolution: "next@npm:13.5.6" - dependencies: - "@next/env": "npm:13.5.6" - "@next/swc-darwin-arm64": "npm:13.5.6" - "@next/swc-darwin-x64": "npm:13.5.6" - "@next/swc-linux-arm64-gnu": "npm:13.5.6" - "@next/swc-linux-arm64-musl": "npm:13.5.6" - "@next/swc-linux-x64-gnu": "npm:13.5.6" - "@next/swc-linux-x64-musl": "npm:13.5.6" - "@next/swc-win32-arm64-msvc": "npm:13.5.6" - "@next/swc-win32-ia32-msvc": "npm:13.5.6" - "@next/swc-win32-x64-msvc": "npm:13.5.6" +"next@npm:^14.1.0": + version: 14.1.0 + resolution: "next@npm:14.1.0" + dependencies: + "@next/env": "npm:14.1.0" + "@next/swc-darwin-arm64": "npm:14.1.0" + "@next/swc-darwin-x64": "npm:14.1.0" + "@next/swc-linux-arm64-gnu": "npm:14.1.0" + "@next/swc-linux-arm64-musl": "npm:14.1.0" + "@next/swc-linux-x64-gnu": "npm:14.1.0" + "@next/swc-linux-x64-musl": "npm:14.1.0" + "@next/swc-win32-arm64-msvc": "npm:14.1.0" + "@next/swc-win32-ia32-msvc": "npm:14.1.0" + "@next/swc-win32-x64-msvc": "npm:14.1.0" "@swc/helpers": "npm:0.5.2" busboy: "npm:1.6.0" - caniuse-lite: "npm:^1.0.30001406" + caniuse-lite: "npm:^1.0.30001579" + graceful-fs: "npm:^4.2.11" postcss: "npm:8.4.31" styled-jsx: "npm:5.1.1" - watchpack: "npm:2.4.0" peerDependencies: "@opentelemetry/api": ^1.1.0 react: ^18.2.0 @@ -11627,7 +11634,7 @@ __metadata: optional: true bin: next: dist/bin/next - checksum: ef141d7708a432aff8bf080d285c466a83b0c1d008d1c66bbd49652a598f9ac15ef2e69a045f21ba44a5543b595cb945468b5f33e25deae2cc48b4d32be5bcec + checksum: dbb1ef8d22eec29a9127d28ed46eb34f14e3f7f7b4e4b91dc96027feb4d9ead554a804275484d9a54026e6e55d632d3997561e598c1fb8e8956e77614f39765f languageName: node linkType: hard @@ -16429,7 +16436,7 @@ __metadata: languageName: node linkType: hard -"watchpack@npm:2.4.0, watchpack@npm:^2.4.0": +"watchpack@npm:^2.4.0": version: 2.4.0 resolution: "watchpack@npm:2.4.0" dependencies: