scanoss 0.2.26 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/.github/workflows/reuse.yml +15 -0
  2. package/.github/workflows/scanoss.yml +24 -0
  3. package/.gitignore +0 -1
  4. package/.idea/.gitignore +5 -0
  5. package/.idea/codeStyles/Project.xml +61 -0
  6. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  7. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  8. package/.idea/modules.xml +8 -0
  9. package/.idea/scanoss.js.iml +12 -0
  10. package/.idea/vcs.xml +6 -0
  11. package/.idea/workspace.xml +366 -0
  12. package/.nyc_output/a25d3ac4-ee71-4c5e-926e-3a17714555cd.json +1 -0
  13. package/.nyc_output/processinfo/a25d3ac4-ee71-4c5e-926e-3a17714555cd.json +1 -0
  14. package/.nyc_output/processinfo/index.json +1 -0
  15. package/.reuse/dep5 +16 -0
  16. package/LICENSES/CC0-1.0.txt +121 -0
  17. package/LICENSES/MIT.txt +9 -0
  18. package/README.md +9 -0
  19. package/build/main/bin/cli-bin.js +5 -3
  20. package/build/main/commands/dep.js +1 -2
  21. package/build/main/commands/fingerprint.js +20 -12
  22. package/build/main/commands/helpers.js +1 -2
  23. package/build/main/commands/scan.js +7 -2
  24. package/build/main/index.js +1 -2
  25. package/build/main/lib/dependencies/DependencyScanner.d.ts +1 -1
  26. package/build/main/lib/dependencies/DependencyScanner.js +23 -12
  27. package/build/main/lib/dependencies/DependencyScannerCfg.js +1 -2
  28. package/build/main/lib/dependencies/DependencyTypes.js +0 -1
  29. package/build/main/lib/dependencies/LocalDependency/DependencyTypes.js +0 -1
  30. package/build/main/lib/dependencies/LocalDependency/LocalDependency.js +3 -2
  31. package/build/main/lib/dependencies/LocalDependency/parsers/golangParser.d.ts +1 -0
  32. package/build/main/lib/dependencies/LocalDependency/parsers/golangParser.js +50 -16
  33. package/build/main/lib/dependencies/LocalDependency/parsers/mavenParser.js +130 -15
  34. package/build/main/lib/dependencies/LocalDependency/parsers/npmParser.d.ts +10 -0
  35. package/build/main/lib/dependencies/LocalDependency/parsers/npmParser.js +146 -10
  36. package/build/main/lib/dependencies/LocalDependency/parsers/pyParser.js +1 -2
  37. package/build/main/lib/dependencies/LocalDependency/parsers/rubyParser.js +1 -2
  38. package/build/main/lib/dependencies/LocalDependency/parsers/utils.js +1 -2
  39. package/build/main/lib/filters/defaultFilter.js +1 -2
  40. package/build/main/lib/filters/filtering.js +1 -2
  41. package/build/main/lib/grpc/GrpcDependencyService.js +1 -2
  42. package/build/main/lib/grpc/scanoss/api/components/v2/scanoss-components_grpc_pb.d.ts +62 -0
  43. package/build/main/lib/grpc/scanoss/api/components/v2/scanoss-components_grpc_pb.js +128 -0
  44. package/build/main/lib/grpc/scanoss/api/components/v2/scanoss-components_pb.d.ts +1 -0
  45. package/build/main/lib/grpc/scanoss/api/components/v2/scanoss-components_pb.js +1403 -0
  46. package/build/main/lib/scanner/Dispatcher/DispatchableItem.d.ts +14 -5
  47. package/build/main/lib/scanner/Dispatcher/DispatchableItem.js +30 -10
  48. package/build/main/lib/scanner/Dispatcher/Dispatcher.d.ts +2 -2
  49. package/build/main/lib/scanner/Dispatcher/Dispatcher.js +10 -15
  50. package/build/main/lib/scanner/Dispatcher/DispatcherResponse.js +1 -2
  51. package/build/main/lib/scanner/Dispatcher/GlobalControllerAborter.js +1 -2
  52. package/build/main/lib/scanner/Scannable/ScannableItem.js +1 -2
  53. package/build/main/lib/scanner/Scanner.js +13 -9
  54. package/build/main/lib/scanner/ScannerCfg.js +2 -3
  55. package/build/main/lib/scanner/ScannerQueue.d.ts +3 -0
  56. package/build/main/lib/scanner/ScannerQueue.js +8 -0
  57. package/build/main/lib/scanner/ScannerTypes.d.ts +9 -2
  58. package/build/main/lib/scanner/ScannerTypes.js +8 -3
  59. package/build/main/lib/scanner/WfpProvider/FingerprintPackage.d.ts +9 -0
  60. package/build/main/lib/scanner/WfpProvider/FingerprintPackage.js +31 -0
  61. package/build/main/lib/scanner/WfpProvider/WfpCalculator/WfpCalculator.js +178 -21
  62. package/build/main/lib/scanner/WfpProvider/WfpCalculator/Winnower.d.ts +3 -0
  63. package/build/main/lib/scanner/WfpProvider/WfpCalculator/Winnower.js +211 -0
  64. package/build/main/lib/scanner/WfpProvider/WfpProvider.d.ts +2 -2
  65. package/build/main/lib/scanner/WfpProvider/WfpProvider.js +6 -7
  66. package/build/main/lib/scanner/WfpProvider/WfpSplitter/WfpSplitter.js +1 -2
  67. package/build/main/lib/tree/File.js +1 -2
  68. package/build/main/lib/tree/Folder.js +1 -2
  69. package/build/main/lib/tree/Node.js +1 -2
  70. package/build/main/lib/tree/Tree.js +1 -2
  71. package/build/module/bin/cli-bin.js +5 -2
  72. package/build/module/commands/fingerprint.js +25 -16
  73. package/build/module/commands/scan.js +8 -2
  74. package/build/module/lib/dependencies/DependencyScanner.d.ts +1 -1
  75. package/build/module/lib/dependencies/DependencyScanner.js +23 -11
  76. package/build/module/lib/dependencies/LocalDependency/LocalDependency.js +5 -3
  77. package/build/module/lib/dependencies/LocalDependency/parsers/golangParser.d.ts +1 -0
  78. package/build/module/lib/dependencies/LocalDependency/parsers/golangParser.js +47 -14
  79. package/build/module/lib/dependencies/LocalDependency/parsers/mavenParser.js +130 -14
  80. package/build/module/lib/dependencies/LocalDependency/parsers/npmParser.d.ts +10 -0
  81. package/build/module/lib/dependencies/LocalDependency/parsers/npmParser.js +140 -8
  82. package/build/module/lib/grpc/scanoss/api/components/v2/scanoss-components_grpc_pb.d.ts +62 -0
  83. package/build/module/lib/grpc/scanoss/api/components/v2/scanoss-components_grpc_pb.js +128 -0
  84. package/build/module/lib/grpc/scanoss/api/components/v2/scanoss-components_pb.d.ts +1 -0
  85. package/build/module/lib/grpc/scanoss/api/components/v2/scanoss-components_pb.js +1403 -0
  86. package/build/module/lib/scanner/Dispatcher/DispatchableItem.d.ts +14 -5
  87. package/build/module/lib/scanner/Dispatcher/DispatchableItem.js +32 -10
  88. package/build/module/lib/scanner/Dispatcher/Dispatcher.d.ts +2 -2
  89. package/build/module/lib/scanner/Dispatcher/Dispatcher.js +10 -14
  90. package/build/module/lib/scanner/Scanner.js +12 -8
  91. package/build/module/lib/scanner/ScannerCfg.js +2 -2
  92. package/build/module/lib/scanner/ScannerQueue.d.ts +3 -0
  93. package/build/module/lib/scanner/ScannerQueue.js +4 -0
  94. package/build/module/lib/scanner/ScannerTypes.d.ts +9 -2
  95. package/build/module/lib/scanner/ScannerTypes.js +7 -1
  96. package/build/module/lib/scanner/WfpProvider/FingerprintPackage.d.ts +9 -0
  97. package/build/module/lib/scanner/WfpProvider/FingerprintPackage.js +30 -0
  98. package/build/module/lib/scanner/WfpProvider/WfpCalculator/WfpCalculator.js +178 -20
  99. package/build/module/lib/scanner/WfpProvider/WfpCalculator/Winnower.d.ts +3 -0
  100. package/build/module/lib/scanner/WfpProvider/WfpCalculator/Winnower.js +211 -0
  101. package/build/module/lib/scanner/WfpProvider/WfpProvider.d.ts +2 -2
  102. package/build/module/lib/scanner/WfpProvider/WfpProvider.js +6 -6
  103. package/build/tsconfig.module.tsbuildinfo +1 -1
  104. package/build/tsconfig.tsbuildinfo +1 -1
  105. package/package.json +6 -17
  106. package/src/bin/cli-bin.ts +4 -1
  107. package/src/commands/fingerprint.ts +26 -17
  108. package/src/commands/scan.ts +16 -3
  109. package/src/lib/dependencies/DependencyScanner.ts +20 -13
  110. package/src/lib/dependencies/LocalDependency/LocalDependency.ts +8 -2
  111. package/src/lib/dependencies/LocalDependency/parsers/golangParser.ts +67 -15
  112. package/src/lib/dependencies/LocalDependency/parsers/mavenParser.ts +143 -16
  113. package/src/lib/dependencies/LocalDependency/parsers/npmParser.ts +182 -7
  114. package/src/lib/scanner/Dispatcher/DispatchableItem.ts +45 -11
  115. package/src/lib/scanner/Dispatcher/Dispatcher.ts +11 -14
  116. package/src/lib/scanner/Scanner.ts +17 -13
  117. package/src/lib/scanner/ScannerCfg.ts +2 -1
  118. package/src/lib/scanner/ScannerTypes.ts +10 -2
  119. package/src/lib/scanner/WfpProvider/{FingerprintPacket.ts → FingerprintPackage.ts} +4 -14
  120. package/src/lib/scanner/WfpProvider/WfpCalculator/WfpCalculator.ts +177 -20
  121. package/src/lib/scanner/WfpProvider/WfpProvider.ts +5 -5
  122. package/tests/WfpCalculator.spec.ts +103 -0
  123. package/tests/data/dependencies/Gemfile/1/Gemfile +6 -0
  124. package/tests/data/dependencies/Gemfile/1/Gemfile~ +0 -0
  125. package/tests/data/dependencies/Gemfile/2/Gemfile +3 -0
  126. package/tests/data/dependencies/Gemfile/2/Gemfile~ +6 -0
  127. package/tests/data/dependencies/Gemfile/3/Gemfile +7 -0
  128. package/tests/data/dependencies/Gemfile/3/Gemfile~ +6 -0
  129. package/tests/data/dependencies/Gemfile/4/Gemfile +31 -0
  130. package/tests/data/dependencies/Gemfile/4/Gemfile~ +7 -0
  131. package/tests/data/dependencies/Gemfile.lock/1/Gemfile.lock +180 -0
  132. package/tests/data/dependencies/Gemfile.lock/2/Gemfile.lock +60 -0
  133. package/tests/data/dependencies/Gemfile.lock/2/Gemfile.lock~ +0 -0
  134. package/tests/data/dependencies/go.sum/1/go.sum +119 -0
  135. package/tests/data/dependencies/go.sum/depJSON.sh +23 -0
  136. package/tests/data/dependencies/package-lock/1/package-lock.json +715 -0
  137. package/tests/data/dependencies/package-lock/2/package-lock.json +32069 -0
  138. package/tests/data/dependencies/package-lock/3/package-lock.json +9013 -0
  139. package/tests/data/dependencies/pom.xml/1/pom.xml +162 -0
  140. package/tests/data/dependencies/yarn-lock/generate_expected_output.sh +4 -0
  141. package/tests/data/dependencies/yarn-lock/v1/yarn.lock +50 -0
  142. package/tests/data/dependencies/yarn-lock/v1/yarn.lock-expected +13 -0
  143. package/tests/data/dependencies/yarn-lock/v1-complex/yarn.lock +27 -0
  144. package/tests/data/dependencies/yarn-lock/v1-complex/yarn.lock-expected +8 -0
  145. package/tests/data/dependencies/yarn-lock/v1-complex2/yarn.lock +220 -0
  146. package/tests/data/dependencies/yarn-lock/v2/yarn.lock +31 -0
  147. package/tests/data/dependencies/yarn-lock/v2/yarn.lock-expected +57 -0
  148. package/tests/data/dependencies/yarn-lock/v2-local/yarn.lock +11 -0
  149. package/tests/data/dependencies/yarn-lock/v2-local/yarn.lock-expected +27204 -0
  150. package/tests/data/scanner/file1.c +41 -0
  151. package/tests/data/scanner/file2.go +87 -0
  152. package/tests/dependencies/golangParser.goModParser.specs.ts +146 -0
  153. package/tests/dependencies/npmParser.spec.ts +133 -0
  154. package/tsconfig.json +4 -3
  155. package/yarn.lock +4596 -5321
  156. package/examples/defaultFilter.json +0 -203
  157. package/package-lock.json +0 -18588
  158. package/src/lib/scanner/Winnower/WinnowerExtractor.ts +0 -37
@@ -1,37 +0,0 @@
1
- import fs from "fs";
2
-
3
- export class WinnowerExtractor {
4
-
5
- private winnowing: string;
6
-
7
- private winnowingFilePath: string;
8
-
9
- private blocksIndex: Array<number>;
10
-
11
- private currentBlock: number;
12
-
13
- constructor() {
14
- this.init();
15
- }
16
-
17
- private init() {
18
- this.winnowing = '';
19
- this.currentBlock = 0;
20
- }
21
-
22
- public loadFile(path: string) {
23
- this.init();
24
- this.winnowingFilePath = path;
25
- this.winnowing = fs.readFileSync(path, 'utf-8');
26
- const reg = /file=/g;
27
- this.blocksIndex = [...((this.winnowing).matchAll(reg))].map(x => x.index);
28
- };
29
-
30
- public extractWinBlock(): string {
31
- let res = '';
32
- if (this.currentBlock < this.blocksIndex.length-1)
33
- res = this.winnowing.substring(this.blocksIndex[this.currentBlock], this.blocksIndex[this.currentBlock+1]);
34
- this.currentBlock+=1;
35
- return res;
36
- }
37
- }