File tree Expand file tree Collapse file tree 4 files changed +15
-2
lines changed
src/compiler/phases/1-parse/state
tests/compiler-errors/samples/component-invalid-name Expand file tree Collapse file tree 4 files changed +15
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' svelte ' : patch
3
+ ---
4
+
5
+ fix: allow more characters in the unicode range as component identifiers
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ const regex_attribute_value = /^(?:"([^"]*)"|'([^'])*'|([^>\s]+))/;
24
24
const regex_valid_element_name =
25
25
/ ^ (?: ! [ a - z A - Z ] + | [ a - z A - Z ] (?: [ a - z A - Z 0 - 9 - ] * [ a - z A - Z 0 - 9 ] ) ? | [ a - z A - Z ] [ a - z A - Z 0 - 9 ] * : [ a - z A - Z ] [ a - z A - Z 0 - 9 - ] * [ a - z A - Z 0 - 9 ] ) $ / ;
26
26
const regex_valid_component_name =
27
- / ^ (?: [ A - Z ] [ A - Z a - z 0 - 9 _ $ . ] * | [ a - z ] [ A - Z a - z 0 - 9 _ $ ] * (?: \. [ A - Z a - z 0 - 9 _ $ ] + ) + ) $ / ;
27
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#identifiers adjusted for our needs
28
+ // (must start with uppercase letter if no dots, can contain dots)
29
+ / ^ (?: \p{ Lu} [ $ \u200c \u200d \p{ ID_Continue} . ] * | \p{ ID_Start} [ $ \u200c \u200d \p{ ID_Continue} ] * (?: \. [ $ \u200c \u200d \p{ ID_Continue} ] + ) + ) $ / u;
28
30
29
31
/** @type {Map<string, ElementLike['type']> } */
30
32
const root_only_meta_tags = new Map ( [
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ export default test({
5
5
code : 'tag_invalid_name' ,
6
6
message :
7
7
'Expected a valid element or component name. Components must have a valid variable name or dot notation expression' ,
8
- position : [ 1 , 14 ]
8
+ position : [ 71 , 84 ]
9
9
}
10
10
} ) ;
Original file line number Diff line number Diff line change
1
+ <!-- ok -->
2
+ <Component />
3
+ <Wundersch ön />
4
+ <C æжαकン中 />
5
+
6
+ <!-- error -->
1
7
<Components [1] />
You can’t perform that action at this time.
0 commit comments