Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: always write moduleResolution to tsconfig.json #37302

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d703033
chore: upgrade `typescript`
balazsorban44 May 30, 2022
b29b74a
refactor: use `CompilerOptions` type
balazsorban44 May 30, 2022
a62e7a2
fix: update `ModuleResolutionKind`
balazsorban44 May 30, 2022
3c45d15
Merge branch 'canary' into fix/write-trsconfig-module-resolution
balazsorban44 May 30, 2022
2e40143
Merge branch 'canary' into fix/write-trsconfig-module-resolution
balazsorban44 May 31, 2022
639a4d2
Merge branch 'canary' into fix/write-trsconfig-module-resolution
balazsorban44 Jun 2, 2022
b4cc7d8
chore: manually update lock file
balazsorban44 Jun 2, 2022
7add58c
chore: autofix pnpm
balazsorban44 Jun 2, 2022
6a8a076
Merge branch 'canary' into fix/write-trsconfig-module-resolution
balazsorban44 Jun 13, 2022
6d5e811
Merge branch 'canary' into fix/write-trsconfig-module-resolution
balazsorban44 Jun 13, 2022
45e593c
chore: upgrade `caniuse-lite`
balazsorban44 Jun 13, 2022
8c62dde
Merge branch 'fix/write-trsconfig-module-resolution' of github.com:ve…
balazsorban44 Jun 13, 2022
9881faa
Merge branch 'canary' into fix/write-trsconfig-module-resolution
balazsorban44 Jul 14, 2022
3d99957
revert some changes
balazsorban44 Jul 14, 2022
a3b503f
bump `@vercel/ncc`
balazsorban44 Jul 14, 2022
c680ff0
fix some ts issues
balazsorban44 Jul 14, 2022
c726d6b
skip lib check for next lib
balazsorban44 Jul 14, 2022
8f65904
⚙ Update compiled files
balazsorban44 Jul 14, 2022
4695abb
update `alex`
balazsorban44 Jul 14, 2022
c76b31b
Merge branch 'fix/write-trsconfig-module-resolution' of github.com:ve…
balazsorban44 Jul 14, 2022
a2b0b3d
update lock file
balazsorban44 Jul 14, 2022
f4b88d3
update to latest `typescript`
balazsorban44 Jul 14, 2022
3d1992a
update lock file again
balazsorban44 Jul 14, 2022
fca9e5f
⚙ Update compiled files
balazsorban44 Jul 14, 2022
c86ed94
add test
balazsorban44 Jul 14, 2022
17174a7
move test
balazsorban44 Jul 14, 2022
6e6e544
rename, remove `.only`
balazsorban44 Jul 14, 2022
cebed76
move test
balazsorban44 Jul 14, 2022
62b8306
Merge branch 'canary' into fix/write-trsconfig-module-resolution
balazsorban44 Jul 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@babel/core": "7.18.0",
"@babel/eslint-parser": "7.18.2",
"@babel/generator": "7.18.0",
"@babel/parser": "7.12.11",
"@babel/parser": "7.18.0",
"@babel/plugin-proposal-object-rest-spread": "7.14.7",
"@babel/preset-flow": "7.14.5",
"@babel/preset-react": "7.14.5",
Expand Down Expand Up @@ -92,8 +92,8 @@
"@webassemblyjs/floating-point-hex-parser": "1.11.1",
"@webassemblyjs/helper-api-error": "1.11.1",
"@webassemblyjs/helper-buffer": "1.11.1",
"@webassemblyjs/helper-code-frame": "npm:empty-npm-package@1.0.0",
"@webassemblyjs/helper-module-context": "npm:empty-npm-package@1.0.0",
"@webassemblyjs/helper-code-frame": "npm:empty-npm-package@^1.0.0",
"@webassemblyjs/helper-module-context": "npm:empty-npm-package@^1.0.0",
"@webassemblyjs/helper-numbers": "1.11.1",
"@webassemblyjs/helper-wasm-bytecode": "1.11.1",
"@webassemblyjs/helper-wasm-section": "1.11.1",
Expand All @@ -104,7 +104,7 @@
"@webassemblyjs/wasm-gen": "1.11.1",
"@webassemblyjs/wasm-opt": "1.11.1",
"@webassemblyjs/wasm-parser": "1.11.1",
"@webassemblyjs/wast-parser": "npm:empty-npm-package@1.0.0",
"@webassemblyjs/wast-parser": "npm:empty-npm-package@^1.0.0",
"@webassemblyjs/wast-printer": "1.11.1",
"@zeit/next-typescript": "1.1.2-canary.0",
"abort-controller": "3.0.0",
Expand Down Expand Up @@ -197,15 +197,15 @@
"tree-kill": "1.2.2",
"tsec": "0.2.1",
"turbo": "1.3.2-canary.1",
"typescript": "4.6.3",
"typescript": "4.7.2",
balazsorban44 marked this conversation as resolved.
Show resolved Hide resolved
"wait-port": "0.2.2",
"webpack": "link:node_modules/webpack5",
"webpack-bundle-analyzer": "4.3.0",
"worker-loader": "3.0.7"
},
"resolutions": {
"browserslist": "4.20.2",
"caniuse-lite": "1.0.30001332",
"caniuse-lite": "1.0.30001346",
"@babel/core": "7.18.0",
"@babel/parser": "7.18.0",
"@babel/types": "7.18.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/create-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
"build": "pnpm release"
},
"devDependencies": {
"@types/async-retry": "1.4.2",
"@types/async-retry": "1.4.4",
"@types/cross-spawn": "6.0.0",
"@types/node": "^12.6.8",
"@types/node": "^12.20.54",
"@types/prompts": "2.0.1",
"@types/rimraf": "3.0.0",
"@types/tar": "4.0.3",
"@types/validate-npm-package-name": "3.0.0",
"@vercel/ncc": "0.33.4",
"@vercel/ncc": "0.34.0",
"async-retry": "1.3.1",
"chalk": "2.4.2",
"commander": "2.20.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
Expand Up @@ -15,6 +15,6 @@
"glob": "7.1.7"
},
"devDependencies": {
"@types/eslint": "7.28.0"
"@types/eslint": "8.4.2"
}
}
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"prepublishOnly": "cd ../../ && turbo run build"
},
"devDependencies": {
"@vercel/ncc": "0.33.4",
"@vercel/ncc": "0.34.0",
"dotenv": "10.0.0",
"dotenv-expand": "8.0.1",
"rimraf": "3.0.2"
Expand Down
6 changes: 4 additions & 2 deletions packages/next/lib/typescript/writeConfigurationDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import semver from 'next/dist/compiled/semver'
import os from 'os'
import { getTypeScriptConfiguration } from './getTypeScriptConfiguration'

import type { CompilerOptions } from 'typescript'

type DesiredCompilerOptionsShape = {
[key: string]:
[K in keyof CompilerOptions]:
| { suggested: any }
| {
parsedValue?: any
Expand Down Expand Up @@ -57,7 +59,7 @@ function getDesiredCompilerOptions(
// All of these values work:
parsedValues: [
ts.ModuleResolutionKind.NodeJs,
ts.ModuleResolutionKind.Node12,
ts.ModuleResolutionKind.Node16,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we leave in Node12 for backwards compat with older TS versions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts.ModuleResolutionKind.NodeNext,
],
value: 'node',
Expand Down
18 changes: 9 additions & 9 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"@types/lodash.curry": "4.1.6",
"@types/lru-cache": "5.1.0",
"@types/micromatch": "4.0.2",
"@types/node-fetch": "2.6.1",
"@types/node-fetch": "2.6.2",
"@types/path-to-regexp": "1.7.0",
"@types/react": "16.9.17",
"@types/react-dom": "16.9.4",
Expand All @@ -164,9 +164,9 @@
"@types/text-table": "0.2.1",
"@types/ua-parser-js": "0.7.36",
"@types/uuid": "8.3.1",
"@types/webpack-sources1": "npm:@types/webpack-sources@0.1.5",
"@types/webpack-sources1": "npm:@types/webpack-sources@^0.1.5",
"@types/ws": "8.2.0",
"@vercel/ncc": "0.33.4",
"@vercel/ncc": "0.34.0",
"@vercel/nft": "0.20.0",
"acorn": "8.5.0",
"ajv": "8.11.0",
Expand All @@ -182,7 +182,7 @@
"buffer": "5.6.0",
"bytes": "3.1.1",
"chalk": "2.4.2",
"ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
"ci-info": "github:watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
"cli-select": "1.1.2",
"comment-json": "3.0.3",
"compression": "1.7.4",
Expand Down Expand Up @@ -216,8 +216,8 @@
"jest-worker": "27.0.0-next.5",
"json5": "2.2.1",
"jsonwebtoken": "8.5.1",
"loader-utils2": "npm:loader-utils@2.0.0",
"loader-utils3": "npm:loader-utils@3.1.3",
"loader-utils2": "npm:loader-utils@^2.0.0",
"loader-utils3": "npm:loader-utils@^3.1.3",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ^ might make this resolve differently when new versions are released

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was autoedited by pnpm. I can try to revert it through 👍

"lodash.curry": "4.1.1",
"lru-cache": "5.1.1",
"micromatch": "4.0.4",
Expand Down Expand Up @@ -250,8 +250,8 @@
"react-server-dom-webpack": "0.0.0-experimental-d2c9e834a-20220601",
"regenerator-runtime": "0.13.4",
"sass-loader": "12.4.0",
"schema-utils2": "npm:schema-utils@2.7.1",
"schema-utils3": "npm:schema-utils@3.0.0",
"schema-utils2": "npm:schema-utils@^2.7.1",
"schema-utils3": "npm:schema-utils@^3.0.0",
"semver": "7.3.2",
"send": "0.17.1",
"setimmediate": "1.0.5",
Expand Down Expand Up @@ -282,7 +282,7 @@
},
"resolutions": {
"browserslist": "4.20.2",
"caniuse-lite": "1.0.30001332"
"caniuse-lite": "1.0.30001346"
},
"engines": {
"node": ">=12.22.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/next/server/base-http/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Req = IncomingMessage & {
export class NodeNextRequest extends BaseNextRequest<Readable> {
public headers = this._req.headers;

[NEXT_REQUEST_META]: RequestMeta
[NEXT_REQUEST_META]!: RequestMeta

get originalRequest() {
// Need to mimic these changes to the original req object for places where we use it:
Expand Down
6 changes: 3 additions & 3 deletions packages/next/server/web/sandbox/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Learn More: https://nextjs.org/docs/messages/middleware-dynamic-wasm-compilation
}

const __fetch = context.fetch
context.fetch = (input: RequestInfo, init: RequestInit = {}) => {
context.fetch = (input: RequestInfo | URL, init: RequestInit = {}) => {
init.headers = new Headers(init.headers ?? {})
const prevs =
init.headers.get(`x-middleware-subrequest`)?.split(':') || []
Expand Down Expand Up @@ -236,8 +236,8 @@ Learn More: https://nextjs.org/docs/messages/middleware-dynamic-wasm-compilation

const __Request = context.Request
context.Request = class extends __Request {
constructor(input: RequestInfo, init?: RequestInit | undefined) {
const url = typeof input === 'string' ? input : input.url
constructor(input: RequestInfo | URL, init?: RequestInit | undefined) {
const url = input instanceof __Request ? input.url : input
validateURL(url)
super(input, init)
}
Expand Down
3 changes: 2 additions & 1 deletion packages/next/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"target": "ES2017",
"esModuleInterop": true,
"moduleResolution": "node",
"jsx": "react"
"jsx": "react",
"skipLibCheck": true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
"exclude": ["dist", "./*.d.ts", "future/*.d.ts", "image-types/global.d.ts"]
}
Loading