Skip to content

Commit

Permalink
Merge pull request #24290 from roottool/feature/24070/convert-babel-p…
Browse files Browse the repository at this point in the history
…lugins

NextJS: Change babel plugins from `proposal-...` to `transform-...`
  • Loading branch information
ndelangen authored Oct 3, 2023
2 parents 5c308f7 + 4e2d75c commit fa57f76
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 73 deletions.
8 changes: 4 additions & 4 deletions code/frameworks/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@
},
"dependencies": {
"@babel/core": "^7.22.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-proposal-numeric-separator": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-syntax-bigint": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-assertions": "^7.22.5",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/plugin-transform-export-namespace-from": "^7.22.11",
"@babel/plugin-transform-numeric-separator": "^7.22.11",
"@babel/plugin-transform-object-rest-spread": "^7.22.15",
"@babel/plugin-transform-runtime": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@babel/preset-react": "^7.22.5",
Expand Down
8 changes: 4 additions & 4 deletions code/frameworks/nextjs/src/babel/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ export default (api: any, options: NextBabelPresetOptions = {}): BabelPreset =>
require('@babel/plugin-syntax-dynamic-import'),
require('@babel/plugin-syntax-import-assertions'),
require('./plugins/react-loadable-plugin'),
[require('@babel/plugin-proposal-class-properties'), options['class-properties'] || {}],
[require('@babel/plugin-transform-class-properties'), options['class-properties'] || {}],
[
require('@babel/plugin-proposal-object-rest-spread'),
require('@babel/plugin-transform-object-rest-spread'),
{
useBuiltIns: true,
},
Expand Down Expand Up @@ -172,8 +172,8 @@ export default (api: any, options: NextBabelPresetOptions = {}): BabelPreset =>
isServer && require('@babel/plugin-syntax-bigint'),
// Always compile numeric separator because the resulting number is
// smaller.
require('@babel/plugin-proposal-numeric-separator'),
require('@babel/plugin-proposal-export-namespace-from'),
require('@babel/plugin-transform-numeric-separator'),
require('@babel/plugin-transform-export-namespace-from'),
].filter(Boolean),
};
};
2 changes: 1 addition & 1 deletion code/lib/docs-tools/src/argTypes/convert/convert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ const transformToModule = (inputCode: string) => {
const annotateWithDocgen = (inputCode: string, filename: string) => {
const options = {
presets: ['@babel/typescript', '@babel/react'],
plugins: ['babel-plugin-react-docgen', '@babel/plugin-proposal-class-properties'],
plugins: ['babel-plugin-react-docgen', '@babel/plugin-transform-class-properties'],
babelrc: false,
filename,
};
Expand Down
2 changes: 1 addition & 1 deletion code/renderers/react/src/docs/extractArgTypes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const transformToModule = (inputCode: string) => {
const annotateWithDocgen = (inputPath: string) => {
const options = {
presets: ['@babel/typescript', '@babel/react'],
plugins: ['babel-plugin-react-docgen', '@babel/plugin-proposal-class-properties'],
plugins: ['babel-plugin-react-docgen', '@babel/plugin-transform-class-properties'],
babelrc: false,
};
const { code } = transformFileSync(inputPath, options) || {};
Expand Down
57 changes: 9 additions & 48 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/compat-data@npm:^7.20.5, @babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.22.9":
"@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.22.9":
version: 7.22.9
resolution: "@babel/compat-data@npm:7.22.9"
checksum: 1334264b041f8ad4e33036326970c9c26754eb5c04b3af6c223fe6da988cbb8a8542b5526f49ec1ac488210d2f710484a0e4bcd30256294ae3f261d0141febad
Expand Down Expand Up @@ -555,7 +555,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/helper-compilation-targets@npm:^7.12.0, @babel/helper-compilation-targets@npm:^7.20.7, @babel/helper-compilation-targets@npm:^7.22.15, @babel/helper-compilation-targets@npm:^7.22.5, @babel/helper-compilation-targets@npm:^7.22.6, @babel/helper-compilation-targets@npm:^7.22.9":
"@babel/helper-compilation-targets@npm:^7.12.0, @babel/helper-compilation-targets@npm:^7.22.15, @babel/helper-compilation-targets@npm:^7.22.5, @babel/helper-compilation-targets@npm:^7.22.6, @babel/helper-compilation-targets@npm:^7.22.9":
version: 7.22.15
resolution: "@babel/helper-compilation-targets@npm:7.22.15"
dependencies:
Expand Down Expand Up @@ -683,7 +683,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.18.9, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3":
"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3":
version: 7.22.5
resolution: "@babel/helper-plugin-utils@npm:7.22.5"
checksum: d2c4bfe2fa91058bcdee4f4e57a3f4933aed7af843acfd169cd6179fab8d13c1d636474ecabb2af107dc77462c7e893199aa26632bac1c6d7e025a17cbb9d20d
Expand Down Expand Up @@ -844,7 +844,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-proposal-class-properties@npm:^7.13.0, @babel/plugin-proposal-class-properties@npm:^7.16.5, @babel/plugin-proposal-class-properties@npm:^7.18.6":
"@babel/plugin-proposal-class-properties@npm:^7.13.0, @babel/plugin-proposal-class-properties@npm:^7.16.5":
version: 7.18.6
resolution: "@babel/plugin-proposal-class-properties@npm:7.18.6"
dependencies:
Expand All @@ -871,18 +871,6 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-proposal-export-namespace-from@npm:^7.18.9":
version: 7.18.9
resolution: "@babel/plugin-proposal-export-namespace-from@npm:7.18.9"
dependencies:
"@babel/helper-plugin-utils": ^7.18.9
"@babel/plugin-syntax-export-namespace-from": ^7.8.3
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: b90346bd3628ebd44138d0628a5aba1e6b11748893fb48e87008cac30f3bc7cd3161362e49433156737350318174164436357a66fbbfdbe952606b460bd8a0e4
languageName: node
linkType: hard

"@babel/plugin-proposal-nullish-coalescing-operator@npm:^7.13.8":
version: 7.18.6
resolution: "@babel/plugin-proposal-nullish-coalescing-operator@npm:7.18.6"
Expand All @@ -895,33 +883,6 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-proposal-numeric-separator@npm:^7.18.6":
version: 7.18.6
resolution: "@babel/plugin-proposal-numeric-separator@npm:7.18.6"
dependencies:
"@babel/helper-plugin-utils": ^7.18.6
"@babel/plugin-syntax-numeric-separator": ^7.10.4
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: a83a65c6ec0d2293d830e9db61406d246f22d8ea03583d68460cb1b6330c6699320acce1b45f66ba3c357830720e49267e3d99f95088be457c66e6450fbfe3fa
languageName: node
linkType: hard

"@babel/plugin-proposal-object-rest-spread@npm:^7.20.7":
version: 7.20.7
resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.20.7"
dependencies:
"@babel/compat-data": ^7.20.5
"@babel/helper-compilation-targets": ^7.20.7
"@babel/helper-plugin-utils": ^7.20.2
"@babel/plugin-syntax-object-rest-spread": ^7.8.3
"@babel/plugin-transform-parameters": ^7.20.7
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: b9818749bb49d8095df64c45db682448d04743d96722984cbfd375733b2585c26d807f84b4fdb28474f2d614be6a6ffe3d96ffb121840e9e5345b2ccc0438bd8
languageName: node
linkType: hard

"@babel/plugin-proposal-optional-chaining@npm:^7.13.12":
version: 7.21.0
resolution: "@babel/plugin-proposal-optional-chaining@npm:7.21.0"
Expand Down Expand Up @@ -1665,7 +1626,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-transform-parameters@npm:^7.20.7, @babel/plugin-transform-parameters@npm:^7.22.15, @babel/plugin-transform-parameters@npm:^7.22.5":
"@babel/plugin-transform-parameters@npm:^7.22.15, @babel/plugin-transform-parameters@npm:^7.22.5":
version: 7.22.15
resolution: "@babel/plugin-transform-parameters@npm:7.22.15"
dependencies:
Expand Down Expand Up @@ -7283,13 +7244,13 @@ __metadata:
resolution: "@storybook/nextjs@workspace:frameworks/nextjs"
dependencies:
"@babel/core": ^7.22.9
"@babel/plugin-proposal-class-properties": ^7.18.6
"@babel/plugin-proposal-export-namespace-from": ^7.18.9
"@babel/plugin-proposal-numeric-separator": ^7.18.6
"@babel/plugin-proposal-object-rest-spread": ^7.20.7
"@babel/plugin-syntax-bigint": ^7.8.3
"@babel/plugin-syntax-dynamic-import": ^7.8.3
"@babel/plugin-syntax-import-assertions": ^7.22.5
"@babel/plugin-transform-class-properties": ^7.22.5
"@babel/plugin-transform-export-namespace-from": ^7.22.11
"@babel/plugin-transform-numeric-separator": ^7.22.11
"@babel/plugin-transform-object-rest-spread": ^7.22.15
"@babel/plugin-transform-runtime": ^7.22.9
"@babel/preset-env": ^7.22.9
"@babel/preset-react": ^7.22.5
Expand Down
2 changes: 1 addition & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
"dependencies": {
"@actions/core": "^1.10.0",
"@babel/core": "^7.22.0",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.22.0",
"@babel/plugin-syntax-class-properties": "^7.12.13",
"@babel/plugin-syntax-decorators": "^7.22.0",
"@babel/plugin-syntax-jsx": "^7.21.0",
"@babel/plugin-syntax-typescript": "^7.21.0",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/preset-env": "^7.22.0",
"@babel/preset-react": "^7.22.0",
"@babel/preset-typescript": "^7.21.0",
Expand Down
16 changes: 2 additions & 14 deletions scripts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/helper-create-class-features-plugin@npm:^7.18.6, @babel/helper-create-class-features-plugin@npm:^7.22.11, @babel/helper-create-class-features-plugin@npm:^7.22.15, @babel/helper-create-class-features-plugin@npm:^7.22.5":
"@babel/helper-create-class-features-plugin@npm:^7.22.11, @babel/helper-create-class-features-plugin@npm:^7.22.15, @babel/helper-create-class-features-plugin@npm:^7.22.5":
version: 7.22.15
resolution: "@babel/helper-create-class-features-plugin@npm:7.22.15"
dependencies:
Expand Down Expand Up @@ -393,18 +393,6 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-proposal-class-properties@npm:^7.18.6":
version: 7.18.6
resolution: "@babel/plugin-proposal-class-properties@npm:7.18.6"
dependencies:
"@babel/helper-create-class-features-plugin": ^7.18.6
"@babel/helper-plugin-utils": ^7.18.6
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: d5172ac6c9948cdfc387e94f3493ad86cb04035cf7433f86b5d358270b1b9752dc25e176db0c5d65892a246aca7bdb4636672e15626d7a7de4bc0bd0040168d9
languageName: node
linkType: hard

"@babel/plugin-proposal-decorators@npm:^7.22.0":
version: 7.22.15
resolution: "@babel/plugin-proposal-decorators@npm:7.22.15"
Expand Down Expand Up @@ -2891,12 +2879,12 @@ __metadata:
dependencies:
"@actions/core": ^1.10.0
"@babel/core": ^7.22.0
"@babel/plugin-proposal-class-properties": ^7.18.6
"@babel/plugin-proposal-decorators": ^7.22.0
"@babel/plugin-syntax-class-properties": ^7.12.13
"@babel/plugin-syntax-decorators": ^7.22.0
"@babel/plugin-syntax-jsx": ^7.21.0
"@babel/plugin-syntax-typescript": ^7.21.0
"@babel/plugin-transform-class-properties": ^7.22.5
"@babel/preset-env": ^7.22.0
"@babel/preset-react": ^7.22.0
"@babel/preset-typescript": ^7.21.0
Expand Down

0 comments on commit fa57f76

Please sign in to comment.