Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: class transform should not drop method definition when key conta…
…ins non-BMP characters (#14897) * polish: improve helper-function-name typings * fix: support non-BMP method name in class transform * polish: use nullish coalescing * add Babel 8 test cases * update JSDoc annotations
- Loading branch information
Showing
39 changed files
with
266 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...asses/test/fixtures/assumption-setClassMethods/method-name-non-bmp-not-supported/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
4 changes: 4 additions & 0 deletions
4
...s/test/fixtures/assumption-setClassMethods/method-name-non-bmp-not-supported/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"targets": "chrome 43", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
...sses/test/fixtures/assumption-setClassMethods/method-name-non-bmp-not-supported/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
var _proto = o.prototype; | ||
|
||
_proto.𠮷野家 = function () {}; | ||
|
||
return babelHelpers.createClass(o); | ||
}(); |
1 change: 1 addition & 0 deletions
1
...n-transform-classes/test/fixtures/assumption-setClassMethods/method-name-non-bmp/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
1 change: 1 addition & 0 deletions
1
...assumption-setClassMethods/method-name-non-bmp/method-name-non-bmp-not-supported/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
4 changes: 4 additions & 0 deletions
4
...mption-setClassMethods/method-name-non-bmp/method-name-non-bmp-not-supported/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"targets": "chrome 43", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
...ssumption-setClassMethods/method-name-non-bmp/method-name-non-bmp-not-supported/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
var _proto = o.prototype; | ||
|
||
_proto.𠮷野家 = function () {}; | ||
|
||
return babelHelpers.createClass(o); | ||
}(); |
4 changes: 4 additions & 0 deletions
4
...ansform-classes/test/fixtures/assumption-setClassMethods/method-name-non-bmp/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"targets": "chrome 44", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
...-transform-classes/test/fixtures/assumption-setClassMethods/method-name-non-bmp/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
var _proto = o.prototype; | ||
|
||
_proto.𠮷野家 = function 𠮷野家() {}; | ||
|
||
return babelHelpers.createClass(o); | ||
}(); |
1 change: 1 addition & 0 deletions
1
...s/babel-plugin-transform-classes/test/fixtures/loose/method-name-non-bmp-babel-7/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
5 changes: 5 additions & 0 deletions
5
...bel-plugin-transform-classes/test/fixtures/loose/method-name-non-bmp-babel-7/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": false, | ||
"targets": "chrome 44", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
.../babel-plugin-transform-classes/test/fixtures/loose/method-name-non-bmp-babel-7/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
babelHelpers.createClass(o, [{ | ||
key: "\uD842\uDFB7\u91CE\u5BB6", | ||
value: function 𠮷野家() {} | ||
}]); | ||
return o; | ||
}(); |
1 change: 1 addition & 0 deletions
1
...-transform-classes/test/fixtures/loose/method-name-non-bmp-not-supported-babel-7/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
5 changes: 5 additions & 0 deletions
5
...nsform-classes/test/fixtures/loose/method-name-non-bmp-not-supported-babel-7/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": false, | ||
"targets": "chrome 43", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
...transform-classes/test/fixtures/loose/method-name-non-bmp-not-supported-babel-7/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
babelHelpers.createClass(o, [{ | ||
key: "\uD842\uDFB7\u91CE\u5BB6", | ||
value: function () {} | ||
}]); | ||
return o; | ||
}(); |
1 change: 1 addition & 0 deletions
1
...l-plugin-transform-classes/test/fixtures/loose/method-name-non-bmp-not-supported/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
5 changes: 5 additions & 0 deletions
5
...ugin-transform-classes/test/fixtures/loose/method-name-non-bmp-not-supported/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": true, | ||
"targets": "chrome 43", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
...-plugin-transform-classes/test/fixtures/loose/method-name-non-bmp-not-supported/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
babelHelpers.createClass(o, [{ | ||
key: "𠮷野家", | ||
value: function () {} | ||
}]); | ||
return o; | ||
}(); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-transform-classes/test/fixtures/loose/method-name-non-bmp/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
5 changes: 5 additions & 0 deletions
5
packages/babel-plugin-transform-classes/test/fixtures/loose/method-name-non-bmp/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": true, | ||
"targets": "chrome 44", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/babel-plugin-transform-classes/test/fixtures/loose/method-name-non-bmp/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
babelHelpers.createClass(o, [{ | ||
key: "𠮷野家", | ||
value: function 𠮷野家() {} | ||
}]); | ||
return o; | ||
}(); |
1 change: 1 addition & 0 deletions
1
...es/babel-plugin-transform-classes/test/fixtures/spec/method-name-non-bmp-babel-7/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
5 changes: 5 additions & 0 deletions
5
...abel-plugin-transform-classes/test/fixtures/spec/method-name-non-bmp-babel-7/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": false, | ||
"targets": "chrome 44", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
...s/babel-plugin-transform-classes/test/fixtures/spec/method-name-non-bmp-babel-7/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
babelHelpers.createClass(o, [{ | ||
key: "\uD842\uDFB7\u91CE\u5BB6", | ||
value: function 𠮷野家() {} | ||
}]); | ||
return o; | ||
}(); |
1 change: 1 addition & 0 deletions
1
...n-transform-classes/test/fixtures/spec/method-name-non-bmp-not-supported-babel-7/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
5 changes: 5 additions & 0 deletions
5
...ansform-classes/test/fixtures/spec/method-name-non-bmp-not-supported-babel-7/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": false, | ||
"targets": "chrome 43", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
...-transform-classes/test/fixtures/spec/method-name-non-bmp-not-supported-babel-7/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
babelHelpers.createClass(o, [{ | ||
key: "\uD842\uDFB7\u91CE\u5BB6", | ||
value: function () {} | ||
}]); | ||
return o; | ||
}(); |
1 change: 1 addition & 0 deletions
1
...el-plugin-transform-classes/test/fixtures/spec/method-name-non-bmp-not-supported/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
5 changes: 5 additions & 0 deletions
5
...lugin-transform-classes/test/fixtures/spec/method-name-non-bmp-not-supported/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": true, | ||
"targets": "chrome 43", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
...l-plugin-transform-classes/test/fixtures/spec/method-name-non-bmp-not-supported/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
babelHelpers.createClass(o, [{ | ||
key: "𠮷野家", | ||
value: function () {} | ||
}]); | ||
return o; | ||
}(); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-transform-classes/test/fixtures/spec/method-name-non-bmp/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var o = class { 𠮷野家() {} }; |
5 changes: 5 additions & 0 deletions
5
packages/babel-plugin-transform-classes/test/fixtures/spec/method-name-non-bmp/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": true, | ||
"targets": "chrome 44", | ||
"plugins": ["transform-classes"] | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/babel-plugin-transform-classes/test/fixtures/spec/method-name-non-bmp/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var o = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function o() { | ||
babelHelpers.classCallCheck(this, o); | ||
} | ||
|
||
babelHelpers.createClass(o, [{ | ||
key: "𠮷野家", | ||
value: function 𠮷野家() {} | ||
}]); | ||
return o; | ||
}(); |
Oops, something went wrong.