Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transform ES2015 Unicode Escapes to ES5 (#11377)
- Loading branch information
1 parent
66b86e0
commit 97f0b7c
Showing
138 changed files
with
468 additions
and
2 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
1 change: 1 addition & 0 deletions
1
...lugin-transform-template-literals/test/fixtures/default/tag-with-unicode-escapes/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 foo = bar`\u0061\u{0061}\ud835\udc9c\u{1d49c}`; |
13 changes: 13 additions & 0 deletions
13
...ugin-transform-template-literals/test/fixtures/default/tag-with-unicode-escapes/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 @@ | ||
function _templateObject() { | ||
const data = _taggedTemplateLiteral(["aa\uD835\uDC9C\uD835\uDC9C"], ["\\u0061\\u{0061}\\ud835\\udc9c\\u{1d49c}"]); | ||
|
||
_templateObject = function () { | ||
return data; | ||
}; | ||
|
||
return data; | ||
} | ||
|
||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
|
||
var foo = bar(_templateObject()); |
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,3 @@ | ||
src | ||
test | ||
*.log |
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,19 @@ | ||
# @babel/plugin-transform-unicode-escapes | ||
|
||
> Compile ES2015 Unicode escapes to ES5 | ||
See our website [@babel/plugin-transform-unicode-escapes](https://babeljs.io/docs/en/next/babel-plugin-transform-unicode-escapes.html) for more information. | ||
|
||
## Install | ||
|
||
Using npm: | ||
|
||
```sh | ||
npm install --save-dev @babel/plugin-transform-unicode-escapes | ||
``` | ||
|
||
or using yarn: | ||
|
||
```sh | ||
yarn add @babel/plugin-transform-unicode-escapes --dev | ||
``` |
24 changes: 24 additions & 0 deletions
24
packages/babel-plugin-transform-unicode-escapes/package.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,24 @@ | ||
{ | ||
"name": "@babel/plugin-transform-unicode-escapes", | ||
"version": "7.8.3", | ||
"description": "Compile ES2015 Unicode escapes to ES5", | ||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-unicode-escapes", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "lib/index.js", | ||
"keywords": [ | ||
"babel-plugin" | ||
], | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^7.8.3" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "^7.0.0-0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.3", | ||
"@babel/helper-plugin-test-runner": "^7.8.3" | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
packages/babel-plugin-transform-unicode-escapes/src/index.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,107 @@ | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
import { types as t } from "@babel/core"; | ||
|
||
export default declare(api => { | ||
api.assertVersion(7); | ||
|
||
const surrogate = /[\ud800-\udfff]/g; | ||
const unicodeEscape = /(\\+)u\{([0-9a-fA-F]+)\}/g; | ||
|
||
function escape(code) { | ||
let str = code.toString(16); | ||
// Sigh, node 6 doesn't have padStart | ||
// TODO: Remove in Babel 8, when we drop node 6. | ||
while (str.length < 4) str = "0" + str; | ||
return "\\u" + str; | ||
} | ||
|
||
function replacer(match, backslashes, code) { | ||
if (backslashes.length % 2 === 0) { | ||
return match; | ||
} | ||
|
||
const char = String.fromCodePoint(parseInt(code, 16)); | ||
const escaped = backslashes.slice(0, -1) + escape(char.charCodeAt(0)); | ||
|
||
return char.length === 1 ? escaped : escaped + escape(char.charCodeAt(1)); | ||
} | ||
|
||
function replaceUnicodeEscapes(str) { | ||
return str.replace(unicodeEscape, replacer); | ||
} | ||
|
||
function getUnicodeEscape(str) { | ||
let match; | ||
while ((match = unicodeEscape.exec(str))) { | ||
if (match[1].length % 2 === 0) continue; | ||
unicodeEscape.lastIndex = 0; | ||
return match[0]; | ||
} | ||
return null; | ||
} | ||
|
||
return { | ||
name: "transform-unicode-escapes", | ||
visitor: { | ||
Identifier(path) { | ||
const { node, key } = path; | ||
const { name } = node; | ||
const replaced = name.replace(surrogate, c => { | ||
return `_u${c.charCodeAt(0).toString(16)}`; | ||
}); | ||
if (name === replaced) return; | ||
|
||
const str = t.inherits(t.stringLiteral(name), node); | ||
|
||
if (key === "key") { | ||
path.replaceWith(str); | ||
return; | ||
} | ||
|
||
const { parentPath, scope } = path; | ||
if ( | ||
parentPath.isMemberExpression({ property: node }) || | ||
parentPath.isOptionalMemberExpression({ property: node }) | ||
) { | ||
parentPath.node.computed = true; | ||
path.replaceWith(str); | ||
return; | ||
} | ||
|
||
const binding = scope.getBinding(name); | ||
if (binding) { | ||
scope.rename(name, scope.generateUid(replaced)); | ||
return; | ||
} | ||
|
||
throw path.buildCodeFrameError( | ||
`Can't reference '${name}' as a bare identifier`, | ||
); | ||
}, | ||
|
||
"StringLiteral|DirectiveLiteral"(path) { | ||
const { node } = path; | ||
const { extra } = node; | ||
|
||
if (extra?.raw) extra.raw = replaceUnicodeEscapes(extra.raw); | ||
}, | ||
|
||
TemplateElement(path) { | ||
const { node, parentPath } = path; | ||
const { value } = node; | ||
|
||
const firstEscape = getUnicodeEscape(value.raw); | ||
if (!firstEscape) return; | ||
|
||
const grandParent = parentPath.parentPath; | ||
if (grandParent.isTaggedTemplateExpression()) { | ||
throw path.buildCodeFrameError( | ||
`Can't replace Unicode escape '${firstEscape}' inside tagged template literals. You can enable '@babel/plugin-transform-template-literals' to compile them to classic strings.`, | ||
); | ||
} | ||
|
||
value.raw = replaceUnicodeEscapes(value.raw); | ||
}, | ||
}, | ||
}; | ||
}); |
1 change: 1 addition & 0 deletions
1
...s/babel-plugin-transform-unicode-escapes/test/fixtures/unicode-escapes/directive/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 @@ | ||
"饾挏\ud835\udc9c\u{1d49c}" |
1 change: 1 addition & 0 deletions
1
.../babel-plugin-transform-unicode-escapes/test/fixtures/unicode-escapes/directive/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 @@ | ||
"饾挏\ud835\udc9c\ud835\udc9c"; |
1 change: 1 addition & 0 deletions
1
...orm-unicode-escapes/test/fixtures/unicode-escapes/escaped-bare-identifier-global/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 @@ | ||
\u{1d49c}; |
3 changes: 3 additions & 0 deletions
3
...unicode-escapes/test/fixtures/unicode-escapes/escaped-bare-identifier-global/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,3 @@ | ||
{ | ||
"throws": "Can't reference '饾挏' as a bare identifier" | ||
} |
2 changes: 2 additions & 0 deletions
2
...-transform-unicode-escapes/test/fixtures/unicode-escapes/escaped-bare-identifier/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,2 @@ | ||
var \u{1d49c} = 1; | ||
\u{1d49c}; |
2 changes: 2 additions & 0 deletions
2
...transform-unicode-escapes/test/fixtures/unicode-escapes/escaped-bare-identifier/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,2 @@ | ||
var _ud835_udc9c = 1; | ||
_ud835_udc9c; |
1 change: 1 addition & 0 deletions
1
...ansform-unicode-escapes/test/fixtures/unicode-escapes/escaped-class-accessor-key/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 { get \u{1d49c}() {} }; |
4 changes: 4 additions & 0 deletions
4
...nsform-unicode-escapes/test/fixtures/unicode-escapes/escaped-class-accessor-key/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,4 @@ | ||
var o = class { | ||
get "\uD835\uDC9C"() {} | ||
|
||
}; |
1 change: 1 addition & 0 deletions
1
...-transform-unicode-escapes/test/fixtures/unicode-escapes/escaped-class-field-key/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 { \u{1d49c} = 1 }; |
3 changes: 3 additions & 0 deletions
3
...nsform-unicode-escapes/test/fixtures/unicode-escapes/escaped-class-field-key/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,3 @@ | ||
{ | ||
"plugins": ["transform-unicode-escapes", "syntax-class-properties"] | ||
} |
3 changes: 3 additions & 0 deletions
3
...transform-unicode-escapes/test/fixtures/unicode-escapes/escaped-class-field-key/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,3 @@ | ||
var o = class { | ||
"\uD835\uDC9C" = 1; | ||
}; |
1 change: 1 addition & 0 deletions
1
...transform-unicode-escapes/test/fixtures/unicode-escapes/escaped-class-method-key/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 { \u{1d49c}() {} }; |
4 changes: 4 additions & 0 deletions
4
...ransform-unicode-escapes/test/fixtures/unicode-escapes/escaped-class-method-key/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,4 @@ | ||
var o = class { | ||
"\uD835\uDC9C"() {} | ||
|
||
}; |
1 change: 1 addition & 0 deletions
1
...-transform-unicode-escapes/test/fixtures/unicode-escapes/escaped-member-property/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 @@ | ||
obj.\u{1d49c}; |
1 change: 1 addition & 0 deletions
1
...transform-unicode-escapes/test/fixtures/unicode-escapes/escaped-member-property/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 @@ | ||
obj["\uD835\uDC9C"]; |
1 change: 1 addition & 0 deletions
1
...nsform-unicode-escapes/test/fixtures/unicode-escapes/escaped-object-accessor-key/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 = { get \u{1d49c}() {} }; |
4 changes: 4 additions & 0 deletions
4
...sform-unicode-escapes/test/fixtures/unicode-escapes/escaped-object-accessor-key/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,4 @@ | ||
var o = { | ||
get "\uD835\uDC9C"() {} | ||
|
||
}; |
1 change: 1 addition & 0 deletions
1
...ransform-unicode-escapes/test/fixtures/unicode-escapes/escaped-object-method-key/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 = { \u{1d49c}() {} }; |
4 changes: 4 additions & 0 deletions
4
...ansform-unicode-escapes/test/fixtures/unicode-escapes/escaped-object-method-key/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,4 @@ | ||
var o = { | ||
"\uD835\uDC9C"() {} | ||
|
||
}; |
1 change: 1 addition & 0 deletions
1
...nsform-unicode-escapes/test/fixtures/unicode-escapes/escaped-object-property-key/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 = { \u{1d49c}: 1 }; |
3 changes: 3 additions & 0 deletions
3
...sform-unicode-escapes/test/fixtures/unicode-escapes/escaped-object-property-key/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,3 @@ | ||
var o = { | ||
"\uD835\uDC9C": 1 | ||
}; |
1 change: 1 addition & 0 deletions
1
...e-escapes/test/fixtures/unicode-escapes/escaped-object-property-shorthand-global/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 = { \u{1d49c} }; |
3 changes: 3 additions & 0 deletions
3
...capes/test/fixtures/unicode-escapes/escaped-object-property-shorthand-global/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,3 @@ | ||
{ | ||
"throws": "Can't reference '饾挏' as a bare identifier" | ||
} |
2 changes: 2 additions & 0 deletions
2
...-unicode-escapes/test/fixtures/unicode-escapes/escaped-object-property-shorthand/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,2 @@ | ||
var \u{1d49c} = 1; | ||
var o = { \u{1d49c} }; |
4 changes: 4 additions & 0 deletions
4
...unicode-escapes/test/fixtures/unicode-escapes/escaped-object-property-shorthand/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,4 @@ | ||
var _ud835_udc9c = 1; | ||
var o = { | ||
"\uD835\uDC9C": _ud835_udc9c | ||
}; |
1 change: 1 addition & 0 deletions
1
...m-unicode-escapes/test/fixtures/unicode-escapes/escaped-optional-member-property/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 @@ | ||
obj?.\u{1d49c}; |
1 change: 1 addition & 0 deletions
1
...-unicode-escapes/test/fixtures/unicode-escapes/escaped-optional-member-property/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 @@ | ||
obj?.["\uD835\uDC9C"]; |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-transform-unicode-escapes/test/fixtures/unicode-escapes/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,3 @@ | ||
{ | ||
"plugins": ["transform-unicode-escapes"] | ||
} |
1 change: 1 addition & 0 deletions
1
...ansform-unicode-escapes/test/fixtures/unicode-escapes/raw-bare-identifier-global/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 @@ | ||
饾挏; |
3 changes: 3 additions & 0 deletions
3
...orm-unicode-escapes/test/fixtures/unicode-escapes/raw-bare-identifier-global/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,3 @@ | ||
{ | ||
"throws": "Can't reference '饾挏' as a bare identifier" | ||
} |
2 changes: 2 additions & 0 deletions
2
...ugin-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-bare-identifier/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,2 @@ | ||
var 饾挏 = 1; | ||
饾挏; |
2 changes: 2 additions & 0 deletions
2
...gin-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-bare-identifier/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,2 @@ | ||
var _ud835_udc9c = 1; | ||
_ud835_udc9c; |
1 change: 1 addition & 0 deletions
1
...n-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-class-accessor-key/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 { get 饾挏 () {} }; |
4 changes: 4 additions & 0 deletions
4
...-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-class-accessor-key/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,4 @@ | ||
var o = class { | ||
get "\uD835\uDC9C"() {} | ||
|
||
}; |
1 change: 1 addition & 0 deletions
1
...ugin-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-class-field-key/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 }; |
3 changes: 3 additions & 0 deletions
3
...-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-class-field-key/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,3 @@ | ||
{ | ||
"plugins": ["transform-unicode-escapes", "syntax-class-properties"] | ||
} |
3 changes: 3 additions & 0 deletions
3
...gin-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-class-field-key/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,3 @@ | ||
var o = class { | ||
"\uD835\uDC9C" = 1; | ||
}; |
1 change: 1 addition & 0 deletions
1
...gin-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-class-method-key/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
...in-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-class-method-key/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,4 @@ | ||
var o = class { | ||
"\uD835\uDC9C"() {} | ||
|
||
}; |
1 change: 1 addition & 0 deletions
1
...ugin-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-member-property/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 @@ | ||
obj.饾挏 ; |
1 change: 1 addition & 0 deletions
1
...gin-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-member-property/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 @@ | ||
obj["\uD835\uDC9C"]; |
1 change: 1 addition & 0 deletions
1
...-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-object-accessor-key/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 = { get 饾挏 () {} }; |
4 changes: 4 additions & 0 deletions
4
...transform-unicode-escapes/test/fixtures/unicode-escapes/raw-object-accessor-key/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,4 @@ | ||
var o = { | ||
get "\uD835\uDC9C"() {} | ||
|
||
}; |
1 change: 1 addition & 0 deletions
1
...in-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-object-method-key/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 = { 饾挏 () {} }; |
4 changes: 4 additions & 0 deletions
4
...n-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-object-method-key/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,4 @@ | ||
var o = { | ||
"\uD835\uDC9C"() {} | ||
|
||
}; |
1 change: 1 addition & 0 deletions
1
...-transform-unicode-escapes/test/fixtures/unicode-escapes/raw-object-property-key/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 = { 饾挏 : 1 }; |
3 changes: 3 additions & 0 deletions
3
...transform-unicode-escapes/test/fixtures/unicode-escapes/raw-object-property-key/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,3 @@ | ||
var o = { | ||
"\uD835\uDC9C": 1 | ||
}; |
1 change: 1 addition & 0 deletions
1
...icode-escapes/test/fixtures/unicode-escapes/raw-object-property-shorthand-global/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 = { 饾挏 }; |
3 changes: 3 additions & 0 deletions
3
...e-escapes/test/fixtures/unicode-escapes/raw-object-property-shorthand-global/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,3 @@ | ||
{ | ||
"throws": "Can't reference '饾挏' as a bare identifier" | ||
} |
2 changes: 2 additions & 0 deletions
2
...form-unicode-escapes/test/fixtures/unicode-escapes/raw-object-property-shorthand/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,2 @@ | ||
var 饾挏 = 1; | ||
var o = { 饾挏 }; |
4 changes: 4 additions & 0 deletions
4
...orm-unicode-escapes/test/fixtures/unicode-escapes/raw-object-property-shorthand/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,4 @@ | ||
var _ud835_udc9c = 1; | ||
var o = { | ||
"\uD835\uDC9C": _ud835_udc9c | ||
}; |
1 change: 1 addition & 0 deletions
1
...sform-unicode-escapes/test/fixtures/unicode-escapes/raw-optional-member-property/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 @@ | ||
obj?.饾挏 ; |
1 change: 1 addition & 0 deletions
1
...form-unicode-escapes/test/fixtures/unicode-escapes/raw-optional-member-property/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 @@ | ||
obj?.["\uD835\uDC9C"]; |
7 changes: 7 additions & 0 deletions
7
...ages/babel-plugin-transform-unicode-escapes/test/fixtures/unicode-escapes/string/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,7 @@ | ||
0; | ||
"饾挏\ud835\udc9c\u{1d49c}"; | ||
"\u{1d49c}"; | ||
"\\u{1d49c}"; | ||
"\\\u{1d49c}"; | ||
"\\\\u{1d49c}"; | ||
|
Oops, something went wrong.