File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
- const exportDefaultContainerRegex = / e x p o r t \s + d e f a u l t \s + .* \( ( [ A - Z ] [ A - Z a - z _ \$ \d ] * ) / g
2
- const exportDefaultRegex = / e x p o r t \s + d e f a u l t (?: \s + c l a s s ) ? \s + ( [ A - Z ] [ A - Z a - z _ \$ \d ] * ) / g
1
+ const exportDefaultContainerRegex = / e x p o r t \s + d e f a u l t \s + .* \( ( [ A - Z ] [ A - Z a - z _ \$ \d ] * ) /
2
+ const exportDefaultRegex = / e x p o r t \s + d e f a u l t (?: \s + c l a s s ) ? \s + ( [ A - Z ] [ A - Z a - z _ \$ \d ] * ) /
3
3
const classNameRegex = / ( c l a s s N a m e = (?: \{ \s * c \( | \{ \s * c l a s s n a m e s \( | \{ \s * ) ? \s * [ \' \" \` ] \s * ) ( [ a - z ] [ a - z A - Z \d _ \- ] * ) / g
4
4
5
5
function loader ( source , inputSourceMap ) {
6
6
this . cacheable ( )
7
- let matches = exportDefaultContainerRegex . exec ( source ) ||
8
- exportDefaultRegex . exec ( source )
7
+ let matches = source . match ( exportDefaultContainerRegex ) || source . match ( exportDefaultRegex )
9
8
10
9
if ( matches ) {
11
10
let jsClassName = matches [ 1 ]
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ describe('className regexps', () => {
41
41
const exportDefaultRegex = / e x p o r t \s + d e f a u l t (?: \s + c l a s s ) ? \s + ( [ A - Z ] [ A - Z a - z _ \$ \d ] * ) /
42
42
let exportDefaultTests = [
43
43
{ in : 'export default MyClass' , out : 'MyClass' } ,
44
+ { in : '\n export default Toolbar \n' , out : 'Toolbar' } ,
45
+ { in : '\n export default Toolbar\n' , out : 'Toolbar' } ,
44
46
{ in : 'export default MyClass' , out : 'MyClass' } ,
45
47
{ in : 'export default class MyClass' , out : 'MyClass' } ,
46
48
{ in : 'export default class MyClass' , out : 'MyClass' } ,
@@ -144,7 +146,7 @@ let loaderFunctionalTest = {
144
146
}
145
147
`
146
148
}
147
- describe . only ( 'loader' , ( ) => {
149
+ describe ( 'loader' , ( ) => {
148
150
149
151
it ( 'big functional test of loader' , ( ) => {
150
152
let context = {
You can’t perform that action at this time.
0 commit comments