File tree 2 files changed +7
-6
lines changed
packages/@css-blocks/core/src
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,13 @@ export const REGEXP_COMMENT_FOOTER = /\/\*#css-blocks end\*\//m;
31
31
* @returns True if valid given the above rules, false otherwise.
32
32
*/
33
33
export function isDefinitionUrlValid ( urlOrPath : string ) : boolean {
34
- // Try to parse as a URL first.
34
+ if ( path . isAbsolute ( urlOrPath ) ) {
35
+ return false ;
36
+ }
35
37
const parsedUrl = url . parse ( urlOrPath ) ;
36
38
if ( parsedUrl . protocol ) {
37
39
return parsedUrl . protocol === "data:" ;
40
+ } else {
41
+ return true ;
38
42
}
39
-
40
- // If we can't parse as a URL with a protocol, it's a path.
41
- return ! path . isAbsolute ( urlOrPath ) ;
42
43
}
Original file line number Diff line number Diff line change @@ -74,13 +74,13 @@ export abstract class BaseImporter implements Importer {
74
74
75
75
// Determine start/end indexes based on the regexp results above.
76
76
const [ headerFullMatch , blockIdFromComment ] = headerRegexpResult ;
77
- const { index : headerStartIndex } = headerRegexpResult ;
77
+ const headerStartIndex = headerRegexpResult . index ;
78
78
if ( ! headerStartIndex ) {
79
79
throw new Error ( "Unable to determine start location of regexp result." ) ;
80
80
}
81
81
const headerEndIndex = headerStartIndex + headerFullMatch . length ;
82
82
const [ footerFullMatch ] = footerRegexpResult ;
83
- const { index : footerStartIndex } = footerRegexpResult ;
83
+ const footerStartIndex = footerRegexpResult . index ;
84
84
if ( ! footerStartIndex ) {
85
85
throw new Error ( "Unable to determine start location of regexp result." ) ;
86
86
}
You can’t perform that action at this time.
0 commit comments