File tree 2 files changed +5
-1
lines changed
2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const importRegex = new RegExp(
29
29
export const fixShorthandImports = code => {
30
30
return code . replaceAll ( importRegex , found => {
31
31
if ( found . indexOf ( " from" ) !== - 1 ) return found
32
- const whatMatch = found . matchAll ( / " ? ( [ ^ " \s ] + ) " ? , ? \s * ?/ giu)
32
+ const whatMatch = found . matchAll ( / " ( [ ^ " \s ] + ) " \s * , ? \s * ?/ giu)
33
33
return [ ...whatMatch ]
34
34
. map ( what => `import ${ what [ 1 ] } from "./${ what [ 1 ] } .cdc"` )
35
35
. join ( "\n" )
Original file line number Diff line number Diff line change 8
8
} from "../../src"
9
9
import { defaultsByName } from "../../src/file"
10
10
import { DEFAULT_TEST_TIMEOUT } from "../util/timeout.const"
11
+ import { fixShorthandImports } from "../../src/imports"
11
12
12
13
jest . setTimeout ( DEFAULT_TEST_TIMEOUT )
13
14
@@ -49,6 +50,9 @@ describe("import resolver", () => {
49
50
access(all) fun main(){}
50
51
`
51
52
53
+ const testFixed = fixShorthandImports ( code )
54
+ expect ( testFixed . includes ( "import.cdc" ) ) . toBe ( false )
55
+
52
56
const addressMap = await resolveImports ( code )
53
57
const Registry = await getServiceAddress ( )
54
58
You can’t perform that action at this time.
0 commit comments