Paolo Tranquilli
10a2824b82
refactor: migrate BUILD files to explicit rules_java imports
...
Add explicit load statements for java_library and java_test from
@rules_java//java:defs.bzl in:
- javascript/extractor/BUILD.bazel
- javascript/extractor/test/com/semmle/js/extractor/test/BUILD.bazel
2026-02-10 13:44:06 +01:00
Asger F
0eadebcabd
Update javascript/extractor/src/com/semmle/js/extractor/FileExtractor.java
...
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2026-01-14 11:40:01 +01:00
Asger F
7ab52a81a7
JS: Add environment variable to opt out of the behaviour if needed
2026-01-14 11:40:01 +01:00
Asger F
98c8b4c080
JS: Skip minified file if avg line length > 200
2026-01-14 11:40:01 +01:00
Paolo Tranquilli
82435218dc
Javascript: fix compilation error after scripted replacement
2025-11-11 12:44:33 +01:00
Paolo Tranquilli
ff62c65cdf
Javascript: avoid null pointer exception on boolean values
2025-11-11 12:11:49 +01:00
Paolo Tranquilli
6ef314ed03
Javascript: fix errors from upcoming rules_java update
2025-11-11 11:53:07 +01:00
Asger F
81bb07a7ba
JS: Fix check to account for override in tests
...
The code was written on the assumption that 'seenCode' implies 'seenFiles' but the unit test override 'hasSeenCode()' to always return true. Which meant we would start taking this branch in the unit tests.
2025-11-04 11:46:02 +01:00
Asger F
105213df03
Update javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java
...
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2025-11-04 09:51:56 +01:00
Asger F
c4d23d16ed
Actions: dont fail if no JS/TS code was found
2025-11-04 09:37:33 +01:00
Asger F
0acfacefbf
JS: Recursively delete source archive so emptiness detection works
2025-10-30 15:31:51 +01:00
Asger F
bab2a79055
JS: Add parsing support in JS parser
2025-09-05 11:57:34 +02:00
Asger F
215602c963
JS: Preserve information about 'defer' keyword
2025-09-05 11:57:33 +02:00
Asger F
0d03c813d0
JS: Also update @types/node version
2025-09-05 11:57:30 +02:00
Asger F
b2b5199055
JS: Bump TypeScript dependency to 5.9
2025-09-05 11:57:29 +02:00
Asger F
67a1c2ffef
Update javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java
...
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2025-09-01 10:20:17 +02:00
Asger F
c1df8a95cb
JS: Overlay extraction support
2025-08-19 09:19:55 +02:00
Taus
30f705822d
JavaScript: Add test where outDir resolves to an unwanted path
2025-07-11 14:58:03 +00:00
Taus
43accc50cd
JavaScript: Ignore outDirs that would exclude everything
...
In #19680 we added support for automatically ignoring files in the
`outDir` directory as specified in the TSconfig compiler options (as
these files were likely duplicates of `.ts` file we were already
scanning).
However, in some cases people put `outDir: "."` or even `outDir: ".."`
in their configuration, which had the side effect of excluding _all_
files, leading to a failed extraction.
With the changes in this PR, we now ignore any `outDir`s that are not
properly contained within the source root of the code being scanned.
This should prevent the files from being extracted, while still allowing
us to not double-scan files in, say, a `.github` directory, as seen in
some Actions workflows.
2025-07-11 13:28:59 +00:00
Asger F
4b2025d2c4
JS: Remove obsolete unit tests
2025-07-02 09:54:18 +02:00
Asger F
2aad14771c
JS: Remove TypeScriptMode
2025-07-02 08:39:17 +02:00
Asger F
5289e4f424
JS: Fix a bug in a unit test
...
The 'extractTypeScriptFiles' override did not incorporate the file type and one of our unit tests was expecting this. The test was previously passing for the wrong reasons.
2025-06-25 14:31:31 +02:00
Asger F
02cdde1447
JS: Fix imprecise condition
2025-06-25 14:31:28 +02:00
Asger F
488da145e8
JS: Don't try to augment invalid files
...
This check existed on the code path for full type extraction, but not for plain single-file extraction.
2025-06-25 14:31:11 +02:00
Asger F
74b817b642
JS: Remove code path for TypeScript full extraction
2025-06-25 14:31:05 +02:00
Asger F
8efa38be79
JS: Change default TypeScript extraction mode to basic
2025-06-23 12:55:20 +02:00
Taus
ac8b41a5da
Merge pull request #19680 from github/tausbn/javascript-exclude-obviously-generated-files
...
JavaScript: Don't extract obviously generated files
2025-06-20 15:52:39 +02:00
Taus
e3d9d92f25
JavaScript: Fix duplicate comment
2025-06-10 12:59:03 +00:00
Taus
f08c2fa387
JavaScript: Move tsconfig files into extractor.tsconfig package
...
Also make the indentation in `CompilerOptions.java` more consistent.
2025-06-10 12:58:48 +00:00
Taus
281ccf7c11
JavaScript: Extract tsconfig.json also in basic mode
...
This is needed for the logic that skips files inside the directory
specified in the `tsconfig.json` `outDir` compiler option.
2025-06-05 15:01:05 +00:00
Taus
619256e037
JavaScript: Fix existing tests and test runner
...
Fixes two things:
- The basic test should no longer extract `tst.js` (as `tst.ts` is
present)
- The `AutoBuild` mock did not populate `extractedFiles` correctly,
which broke the logic that looks for TypeScript files with the same
basename.
2025-06-05 14:59:40 +00:00
Taus
8829f7820a
JavaScript: Don't extract files with TypeScript progenitors
2025-06-05 14:57:00 +00:00
Taus
14f50880e9
JavaScript: Don't extract files in tsconfig.json outDir
2025-06-05 14:56:59 +00:00
Asger F
11607e5f62
JS: Update TRAP after extractor change
2025-05-20 13:20:36 +02:00
Asger F
50e4ac8298
JS: Do not ignore variables from ambient declarations
2025-05-20 13:19:51 +02:00
Asger F
359525b65a
JS: Extract more tsconfig.json patterns
2025-04-29 12:46:49 +02:00
Asger F
8c0b0c4800
JS: Ensure json files are extracted properly in tests
2025-04-29 12:46:20 +02:00
Asger F
152d6f3c29
JS: Tolerate trailing comma in JSON objects
2025-04-28 10:56:48 +02:00
Asger F
6dd8114f00
JS: Add test with trailing comma in JSON object
2025-04-28 10:56:34 +02:00
Asger F
cfa1a9b603
JS: Update extractor version string
2025-04-10 07:20:53 +02:00
Asger F
1434f7acd2
JS: Tolerate trailing comma in JSON array
...
Previously we'd fail to extract some tsconfig.json files because of this.
2025-04-10 07:20:51 +02:00
Asger F
800dd168c2
JS: Add failing TRAP test for trailing comma
2025-04-10 07:20:49 +02:00
Asger F
ee867e99c7
Merge pull request #19117 from lcartey/lcartey/support-sap-json-formats
...
JavaScript: Add support for indexing additional SAP related JSON files
2025-03-31 10:30:11 +02:00
Asger F
c8817d9667
JS: Parse with proper locations
2025-03-27 11:51:23 +01:00
Asger F
cc2bec0808
JS: Ensure correct value is used in parseNameExpression()
...
The call to expect() below here updates 'token' and 'value' to that of the NEXT token (not the name).
The code happened to work because the 'value' field is only updated if a token with a relevant value is found. E.g. if a name token could be followed by another name, then we would have seen the wrong name here.
2025-03-27 11:51:21 +01:00
Asger F
b1554443d8
JS: Update TRAP output
2025-03-27 11:51:19 +01:00
Asger F
fa53ff9f3e
JS: Update extractor version string
2025-03-27 11:51:16 +01:00
Asger F
3a6089740e
JS: Separate JSDoc qualified names into individual identifiers
2025-03-27 11:51:14 +01:00
Asger F
c61454b5ca
JS: Remove unused 'spec' field
2025-03-27 11:51:13 +01:00
Luke Cartey
8814077c76
Add support for additional SAP JSON formats.
2025-03-25 17:01:37 +00:00