File tree 7 files changed +23
-7
lines changed
lib/semmle/javascript/frameworks
test/library-tests/PathResolution
7 files changed +23
-7
lines changed Original file line number Diff line number Diff line change 3
3
*/
4
4
5
5
import javascript
6
+ private import semmle.javascript.internal.paths.PathMapping
6
7
7
8
module Babel {
8
9
/**
@@ -202,4 +203,12 @@ module Babel {
202
203
)
203
204
}
204
205
}
206
+
207
+ private class BabelPathMapping extends PathMapping , RootImportConfig {
208
+ override File getAnAffectedFile ( ) { result = this .getConfig ( ) .getAContainerInScope ( ) }
209
+
210
+ override predicate hasPrefixPathMapping ( string pattern , Container newContext , string newPath ) {
211
+ newPath = this .getRoot ( pattern ) and newContext = this .getFolder ( )
212
+ }
213
+ }
205
214
}
Original file line number Diff line number Diff line change 1
- import f from '~/a' ; // $ MISSING: importTarget=BabelRootImport/tst1/a.js
1
+ import f from '~/a' ; // $ importTarget=BabelRootImport/tst1/a.js
Original file line number Diff line number Diff line change 1
- import f from '~/a' ; // $ MISSING: importTarget=BabelRootImport/tst1/a.js
1
+ import f from '~/a' ; // $ importTarget=BabelRootImport/tst1/a.js
Original file line number Diff line number Diff line change 1
- import g from '~/b.js' ; // $ MISSING: importTarget=BabelRootImport/tst2/src/js/b.js
2
- import f from '#/a' ; // $ MISSING: importTarget=BabelRootImport/tst1/a.js
1
+ import g from '~/b.js' ; // $ importTarget=BabelRootImport/tst2/src/js/b.js
2
+ import f from '#/a' ; // $ importTarget=BabelRootImport/tst1/a.js
Original file line number Diff line number Diff line change 1
- import greeting from '~/b.js' ; // $ MISSING: importTarget=BabelRootImport/tst3/src/b.js
1
+ import greeting from '~/b.js' ; // $ importTarget=BabelRootImport/tst3/src/b.js
Original file line number Diff line number Diff line change 1
- import g from '~/b.js' ; // $ MISSING: importTarget=BabelRootImport/tst4/src/js/b.js
2
- import f from '#/a' ; // $ MISSING: importTarget=BabelRootImport/tst1/a.js
1
+ import g from '~/b.js' ; // $ importTarget=BabelRootImport/tst4/src/js/b.js
2
+ import f from '#/a' ; // $ importTarget=BabelRootImport/tst1/a.js
Original file line number Diff line number Diff line change
1
+ | BabelRootImport/tst1/index.js:1:1:1:20 | import f from '~/a'; | BabelRootImport/tst1/a.js |
2
+ | BabelRootImport/tst1/nested/tst.js:1:1:1:20 | import f from '~/a'; | BabelRootImport/tst1/a.js |
3
+ | BabelRootImport/tst2/index.js:1:1:1:23 | import ... /b.js'; | BabelRootImport/tst2/src/js/b.js |
4
+ | BabelRootImport/tst2/index.js:2:1:2:20 | import f from '#/a'; | BabelRootImport/tst1/a.js |
5
+ | BabelRootImport/tst3/index.js:1:1:1:30 | import ... /b.js'; | BabelRootImport/tst3/src/b.js |
6
+ | BabelRootImport/tst4/index.js:1:1:1:23 | import ... /b.js'; | BabelRootImport/tst4/src/js/b.js |
7
+ | BabelRootImport/tst4/index.js:2:1:2:20 | import f from '#/a'; | BabelRootImport/tst1/a.js |
1
8
| BaseUrl/src/main.ts:2:1:2:26 | import ... /file"; | BaseUrl/base/lib/file.ts |
2
9
| BaseUrl/src/main.ts:3:1:3:29 | import ... le.ts"; | BaseUrl/base/lib/file.ts |
3
10
| BaseUrl/src/main.ts:4:1:4:29 | import ... le.js"; | BaseUrl/base/lib/file.ts |
You can’t perform that action at this time.
0 commit comments