You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// A pragma value is invalid if any of the following are true:
95
-
/// - It is an empty string
96
-
/// - The root part is a reserved keyword (except `this`, `null`, `true`, `false`, `import.meta`)
97
-
/// - Any part is not a valid identifier name
98
-
///
99
-
/// Based on <https://github.com/evanw/esbuild/blob/5e0e56d6d62076dfeff47f5227ae5300f91d2b16/internal/js_parser/js_parser.go#L18027-L18060>
100
-
fnis_valid_pragma_value(value:&str) -> bool{
101
-
if value.is_empty(){
102
-
returnfalse;
103
-
}
104
-
105
-
letmut parts = value.split('.');
106
-
107
-
letSome(root) = parts.next()else{
108
-
unreachable!();
109
-
};
110
-
111
-
match root {
112
-
// Allow `this`, `null`, `true`, `false` keywords
113
-
"this" | "null" | "true" | "false" => {}
114
-
// Allow `import.meta`
115
-
"import" => {
116
-
if !matches!(parts.next(),Some("meta")){
117
-
returnfalse;
118
-
}
119
-
}
120
-
// Otherwise, it must be a valid identifier and not a reserved keyword
Copy file name to clipboardExpand all lines: tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/invalid-jsx-frag/input.jsx
Copy file name to clipboardExpand all lines: tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/invalid-jsx-frag/options.json
0 commit comments