From 01bdacaedfbd8363829d477e45f695101b79ccdb Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Tue, 1 Nov 2022 19:24:46 +0800 Subject: [PATCH 1/6] test --- scripts/integration-tests/e2e-prettier.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/integration-tests/e2e-prettier.sh b/scripts/integration-tests/e2e-prettier.sh index e9df53316a89..a150a697fc7c 100755 --- a/scripts/integration-tests/e2e-prettier.sh +++ b/scripts/integration-tests/e2e-prettier.sh @@ -36,6 +36,9 @@ startLocalRegistry "$root"/verdaccio-config.yml yarn install --no-immutable yarn info +# Test typings for @babel/parser +yarn lint:typecheck + # https://github.com/babel/babel/pull/14892#issuecomment-1233180626 echo "export default () => () => {}" > src/main/create-print-pre-check-function.js From 0e2888e9a89175f5f9d5ee1b44399d6386606f7a Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Wed, 2 Nov 2022 23:07:47 +0800 Subject: [PATCH 2/6] fix babel8 types --- packages/babel-parser/package.json | 6 ++++-- packages/babel-types/package.json | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/babel-parser/package.json b/packages/babel-parser/package.json index 5e8720afb711..3a1023695936 100644 --- a/packages/babel-parser/package.json +++ b/packages/babel-parser/package.json @@ -55,7 +55,8 @@ "exports": { ".": { "require": "./lib/index.cjs", - "default": "./lib/index.js" + "default": "./lib/index.js", + "types": "./typings/babel-parser.d.ts" }, "./package.json": "./package.json" } @@ -66,7 +67,8 @@ "exports": { ".": { "require": "./index.cjs", - "default": "./lib/index.js" + "default": "./lib/index.js", + "types": "./typings/babel-parser.d.ts" }, "./package.json": "./package.json" }, diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 164d1a57e8ac..42bc4ee35976 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -52,7 +52,10 @@ ] }, "exports": { - ".": "./lib/index.js", + ".": { + "default": "./lib/index.js", + "types": "./lib/index-legacy.d.ts" + }, "./package.json": "./package.json" }, "type": "commonjs" From d41df1416980eed74eb4854d71d40962e194cfb8 Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Wed, 2 Nov 2022 23:12:59 +0800 Subject: [PATCH 3/6] ignore --- packages/babel-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-parser/package.json b/packages/babel-parser/package.json index 3a1023695936..5a69a9e44756 100644 --- a/packages/babel-parser/package.json +++ b/packages/babel-parser/package.json @@ -27,7 +27,7 @@ "files": [ "bin", "lib", - "typings", + "typings/babel-parser.d.ts", "index.cjs" ], "engines": { From 6108868b2d746d15117412907fff98d79bde4afc Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Thu, 3 Nov 2022 19:50:05 +0800 Subject: [PATCH 4/6] fix constraints --- constraints.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/constraints.pro b/constraints.pro index 9a5b3650a0ab..36b864b27eca 100644 --- a/constraints.pro +++ b/constraints.pro @@ -85,6 +85,7 @@ gen_enforced_field(WorkspaceCwd, 'exports', '{ ".": "./lib/index.js", "./package WorkspaceIdent \= '@babel/parser', WorkspaceIdent \= '@babel/plugin-transform-react-jsx', % TODO: Remove in Babel 8 WorkspaceIdent \= '@babel/standalone', + WorkspaceIdent \= '@babel/types', % @babel/types has types exports \+ atom_concat('@babel/eslint-', _, WorkspaceIdent), \+ atom_concat('@babel/runtime', _, WorkspaceIdent). From a8f63aa6abc4bd6ea4223ea25ece276b05d0582f Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Fri, 4 Nov 2022 17:52:49 +0800 Subject: [PATCH 5/6] order --- packages/babel-parser/package.json | 8 ++++---- packages/babel-types/package.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/babel-parser/package.json b/packages/babel-parser/package.json index 5a69a9e44756..f436a1929fde 100644 --- a/packages/babel-parser/package.json +++ b/packages/babel-parser/package.json @@ -54,9 +54,9 @@ "type": "module", "exports": { ".": { + "types": "./typings/babel-parser.d.ts", "require": "./lib/index.cjs", - "default": "./lib/index.js", - "types": "./typings/babel-parser.d.ts" + "default": "./lib/index.js" }, "./package.json": "./package.json" } @@ -66,9 +66,9 @@ }, "exports": { ".": { + "types": "./typings/babel-parser.d.ts", "require": "./index.cjs", - "default": "./lib/index.js", - "types": "./typings/babel-parser.d.ts" + "default": "./lib/index.js" }, "./package.json": "./package.json" }, diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 42bc4ee35976..094b647c2416 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -53,8 +53,8 @@ }, "exports": { ".": { - "default": "./lib/index.js", - "types": "./lib/index-legacy.d.ts" + "types": "./lib/index-legacy.d.ts", + "default": "./lib/index.js" }, "./package.json": "./package.json" }, From 8bf221e59acff8eb7f9e17bec9d02158d1b16543 Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Wed, 9 Nov 2022 23:42:38 +0800 Subject: [PATCH 6/6] fix --- packages/babel-types/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 094b647c2416..8266e86c551d 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -53,6 +53,7 @@ }, "exports": { ".": { + "types@>=3.7": "./lib/index.d.ts", "types": "./lib/index-legacy.d.ts", "default": "./lib/index.js" },