JS: classify the ApplicationInsights library instance

This commit is contained in:
Esben Sparre Andreasen
2018-08-08 15:39:22 +02:00
parent 87f9ecb442
commit 2589cf70c9
3 changed files with 29 additions and 0 deletions

View File

@@ -816,6 +816,33 @@ private class RequireJS extends FrameworkLibraryWithGenericURL, FrameworkLibrary
}
}
/**
* A copy of the Microsoft ApplicationInsights framework.
*/
private class ApplicationInsightsInstance extends FrameworkLibraryInstance {
string version;
ApplicationInsightsInstance() {
version = this.(TopLevel).getFile().getAbsolutePath().regexpCapture(any(ApplicationInsights t).getAURLRegex(), 1)
}
override predicate info(FrameworkLibrary fl, string v) {
fl instanceof ApplicationInsights and
version = v
}
}
/**
* The Microsoft ApplicationInsights framework.
*/
private class ApplicationInsights extends FrameworkLibraryWithURLRegex {
ApplicationInsights() { this = "ApplicationInsights" }
override string getAURLRegex() {
result = ".*(?:^|/)ai\\.(" + semverRegex() + ")-build\\d+\\.js"
}
}
/**
* A `FrameworkLibraryReference` that refers to a recognised `FrameworkLibraryInstance`,
* that is, a `<script>` tag where the `src` attribute can be resolved to a local file

View File

@@ -1,3 +1,4 @@
| ai.1.2.3-build0123.js:0:0:0:0 | ai.1.2.3-build0123.js | library |
| bundle-directive.js:0:0:0:0 | bundle-directive.js | generated |
| jison-lex.js:0:0:0:0 | jison-lex.js | generated |
| jison.js:0:0:0:0 | jison.js | generated |