@trustify-da/trustify-da-javascript-client 0.2.4-ea-1

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 (57) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +482 -0
  3. package/config/config.properties +1 -0
  4. package/dist/package.json +110 -0
  5. package/dist/src/analysis.d.ts +43 -0
  6. package/dist/src/analysis.js +252 -0
  7. package/dist/src/cli.d.ts +2 -0
  8. package/dist/src/cli.js +102 -0
  9. package/dist/src/cyclone_dx_sbom.d.ts +77 -0
  10. package/dist/src/cyclone_dx_sbom.js +244 -0
  11. package/dist/src/index.d.ts +82 -0
  12. package/dist/src/index.js +194 -0
  13. package/dist/src/oci_image/images.d.ts +99 -0
  14. package/dist/src/oci_image/images.js +263 -0
  15. package/dist/src/oci_image/platform.d.ts +59 -0
  16. package/dist/src/oci_image/platform.js +138 -0
  17. package/dist/src/oci_image/utils.d.ts +42 -0
  18. package/dist/src/oci_image/utils.js +496 -0
  19. package/dist/src/provider.d.ts +29 -0
  20. package/dist/src/provider.js +47 -0
  21. package/dist/src/providers/base_java.d.ts +85 -0
  22. package/dist/src/providers/base_java.js +191 -0
  23. package/dist/src/providers/base_javascript.d.ts +127 -0
  24. package/dist/src/providers/base_javascript.js +350 -0
  25. package/dist/src/providers/golang_gomodules.d.ts +42 -0
  26. package/dist/src/providers/golang_gomodules.js +403 -0
  27. package/dist/src/providers/java_gradle.d.ts +35 -0
  28. package/dist/src/providers/java_gradle.js +399 -0
  29. package/dist/src/providers/java_gradle_groovy.d.ts +7 -0
  30. package/dist/src/providers/java_gradle_groovy.js +19 -0
  31. package/dist/src/providers/java_gradle_kotlin.d.ts +11 -0
  32. package/dist/src/providers/java_gradle_kotlin.js +23 -0
  33. package/dist/src/providers/java_maven.d.ts +52 -0
  34. package/dist/src/providers/java_maven.js +263 -0
  35. package/dist/src/providers/javascript_npm.d.ts +4 -0
  36. package/dist/src/providers/javascript_npm.js +15 -0
  37. package/dist/src/providers/javascript_pnpm.d.ts +5 -0
  38. package/dist/src/providers/javascript_pnpm.js +22 -0
  39. package/dist/src/providers/javascript_yarn.d.ts +11 -0
  40. package/dist/src/providers/javascript_yarn.js +39 -0
  41. package/dist/src/providers/manifest.d.ts +11 -0
  42. package/dist/src/providers/manifest.js +48 -0
  43. package/dist/src/providers/processors/yarn_berry_processor.d.ts +41 -0
  44. package/dist/src/providers/processors/yarn_berry_processor.js +130 -0
  45. package/dist/src/providers/processors/yarn_classic_processor.d.ts +37 -0
  46. package/dist/src/providers/processors/yarn_classic_processor.js +109 -0
  47. package/dist/src/providers/processors/yarn_processor.d.ts +9 -0
  48. package/dist/src/providers/processors/yarn_processor.js +20 -0
  49. package/dist/src/providers/python_controller.d.ts +31 -0
  50. package/dist/src/providers/python_controller.js +406 -0
  51. package/dist/src/providers/python_pip.d.ts +35 -0
  52. package/dist/src/providers/python_pip.js +227 -0
  53. package/dist/src/sbom.d.ts +59 -0
  54. package/dist/src/sbom.js +84 -0
  55. package/dist/src/tools.d.ts +74 -0
  56. package/dist/src/tools.js +159 -0
  57. package/package.json +110 -0
@@ -0,0 +1,42 @@
1
+ declare namespace _default {
2
+ export { isSupported };
3
+ export { validateLockFile };
4
+ export { provideComponent };
5
+ export { provideStack };
6
+ }
7
+ export default _default;
8
+ export type Provided = import('../provider').Provided;
9
+ export type Package = {
10
+ name: string;
11
+ version: string;
12
+ };
13
+ export type Dependency = {
14
+ groupId: string;
15
+ artifactId: string;
16
+ version: string;
17
+ scope: string;
18
+ ignore: boolean;
19
+ };
20
+ /**
21
+ * @param {string} manifestName - the subject manifest name-type
22
+ * @returns {boolean} - return true if `pom.xml` is the manifest name-type
23
+ */
24
+ declare function isSupported(manifestName: string): boolean;
25
+ /**
26
+ * @param {string} manifestDir - the directory where the manifest lies
27
+ */
28
+ declare function validateLockFile(): boolean;
29
+ /**
30
+ * Provide content and content type for maven-maven component analysis.
31
+ * @param {string} manifest - path to go.mod for component report
32
+ * @param {{}} [opts={}] - optional various options to pass along the application
33
+ * @returns {Provided}
34
+ */
35
+ declare function provideComponent(manifest: string, opts?: {} | undefined): Provided;
36
+ /**
37
+ * Provide content and content type for maven-maven stack analysis.
38
+ * @param {string} manifest - the manifest path or name
39
+ * @param {{}} [opts={}] - optional various options to pass along the application
40
+ * @returns {Provided}
41
+ */
42
+ declare function provideStack(manifest: string, opts?: {} | undefined): Provided;
@@ -0,0 +1,403 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { EOL } from "os";
4
+ import { PackageURL } from 'packageurl-js';
5
+ import Sbom from '../sbom.js';
6
+ import { getCustom, getCustomPath, invokeCommand } from "../tools.js";
7
+ export default { isSupported, validateLockFile, provideComponent, provideStack };
8
+ /** @typedef {import('../provider').Provider} */
9
+ /** @typedef {import('../provider').Provided} Provided */
10
+ /** @typedef {{name: string, version: string}} Package */
11
+ /** @typedef {{groupId: string, artifactId: string, version: string, scope: string, ignore: boolean}} Dependency */
12
+ /**
13
+ * @type {string} ecosystem for npm-npm is 'maven'
14
+ * @private
15
+ */
16
+ const ecosystem = 'golang';
17
+ const defaultMainModuleVersion = "v0.0.0";
18
+ /**
19
+ * @param {string} manifestName - the subject manifest name-type
20
+ * @returns {boolean} - return true if `pom.xml` is the manifest name-type
21
+ */
22
+ function isSupported(manifestName) {
23
+ return 'go.mod' === manifestName;
24
+ }
25
+ /**
26
+ * @param {string} manifestDir - the directory where the manifest lies
27
+ */
28
+ function validateLockFile() { return true; }
29
+ /**
30
+ * Provide content and content type for maven-maven stack analysis.
31
+ * @param {string} manifest - the manifest path or name
32
+ * @param {{}} [opts={}] - optional various options to pass along the application
33
+ * @returns {Provided}
34
+ */
35
+ function provideStack(manifest, opts = {}) {
36
+ return {
37
+ ecosystem,
38
+ content: getSBOM(manifest, opts, true),
39
+ contentType: 'application/vnd.cyclonedx+json'
40
+ };
41
+ }
42
+ /**
43
+ * Provide content and content type for maven-maven component analysis.
44
+ * @param {string} manifest - path to go.mod for component report
45
+ * @param {{}} [opts={}] - optional various options to pass along the application
46
+ * @returns {Provided}
47
+ */
48
+ function provideComponent(manifest, opts = {}) {
49
+ return {
50
+ ecosystem,
51
+ content: getSBOM(manifest, opts, false),
52
+ contentType: 'application/vnd.cyclonedx+json'
53
+ };
54
+ }
55
+ /**
56
+ *
57
+ * @param {string} edge containing an edge of direct graph of source dependency (parent) and target dependency (child)
58
+ * @return {string} the parent (source) dependency
59
+ */
60
+ function getParentVertexFromEdge(edge) {
61
+ return edge.split(" ")[0];
62
+ }
63
+ /**
64
+ *
65
+ * @param {string} edge containing an edge of direct graph of source dependency (parent) and target dependency (child)
66
+ * @return {string} the child (target) dependency
67
+ */
68
+ function getChildVertexFromEdge(edge) {
69
+ return edge.split(" ")[1];
70
+ }
71
+ /**
72
+ *
73
+ * @param line one row from go.mod file
74
+ * @return {boolean} whether line from go.mod should be considered as ignored or not
75
+ */
76
+ function ignoredLine(line) {
77
+ let result = false;
78
+ if (line.match(".*exhortignore.*")) {
79
+ if (line.match(".+//\\s*exhortignore") || line.match(".+//\\sindirect (//)?\\s*exhortignore")) {
80
+ let trimmedRow = line.trim();
81
+ if (!trimmedRow.startsWith("module ") && !trimmedRow.startsWith("go ") && !trimmedRow.startsWith("require (") && !trimmedRow.startsWith("require(")
82
+ && !trimmedRow.startsWith("exclude ") && !trimmedRow.startsWith("replace ") && !trimmedRow.startsWith("retract ") && !trimmedRow.startsWith("use ")
83
+ && !trimmedRow.includes("=>")) {
84
+ if (trimmedRow.startsWith("require ") || trimmedRow.match("^[a-z.0-9/-]+\\s{1,2}[vV][0-9]\\.[0-9](\\.[0-9]){0,2}.*")) {
85
+ result = true;
86
+ }
87
+ }
88
+ }
89
+ }
90
+ return result;
91
+ }
92
+ /**
93
+ * extract package name from go.mod line that contains exhortignore comment.
94
+ * @param line a row contains exhortignore as part of a comment
95
+ * @return {string} the full package name + group/namespace + version
96
+ * @private
97
+ */
98
+ function extractPackageName(line) {
99
+ let trimmedRow = line.trim();
100
+ let firstRemarkNotationOccurrence = trimmedRow.indexOf("//");
101
+ return trimmedRow.substring(0, firstRemarkNotationOccurrence).trim();
102
+ }
103
+ /**
104
+ *
105
+ * @param {string } manifest - path to manifest
106
+ * @return {[PackageURL]} list of ignored dependencies d
107
+ */
108
+ function getIgnoredDeps(manifest) {
109
+ let goMod = fs.readFileSync(manifest).toString().trim();
110
+ let lines = goMod.split(getLineSeparatorGolang());
111
+ return lines.filter(line => ignoredLine(line)).map(line => extractPackageName(line)).map(dep => toPurl(dep, /[ ]{1,3}/));
112
+ }
113
+ /**
114
+ *
115
+ * @param {[PackageURL]}allIgnoredDeps - list of purls of all dependencies that should be ignored
116
+ * @param {PackageURL} purl object to be checked if needed to be ignored
117
+ * @return {boolean}
118
+ */
119
+ function dependencyNotIgnored(allIgnoredDeps, purl) {
120
+ return allIgnoredDeps.find(element => element.toString() === purl.toString()) === undefined;
121
+ }
122
+ function enforceRemovingIgnoredDepsInCaseOfAutomaticVersionUpdate(ignoredDeps, sbom) {
123
+ // In case there is a dependency commented with exhortignore , but it is still in the list of direct dependencies of root, then
124
+ // the reason for that is that go mod graph changed automatically the version of package/module to different version, and because of
125
+ // mismatch between the version in go.mod manifest and go mod graph, it wasn't delete ==> in this case need to remove from sbom according to name only.
126
+ ignoredDeps.forEach(packageUrl => {
127
+ if (sbom.checkIfPackageInsideDependsOnList(sbom.getRoot(), packageUrl.name)) {
128
+ sbom.filterIgnoredDeps(ignoredDeps.filter(purl => purl.name === packageUrl.name).map(purl => purl.name));
129
+ }
130
+ });
131
+ }
132
+ /**
133
+ *
134
+ * @param {[string]} lines - array of lines of go.mod manifest
135
+ * @param {string} goMod - content of go.mod manifest
136
+ * @return {[string]} all dependencies from go.mod file as array
137
+ */
138
+ function collectAllDepsFromManifest(lines, goMod) {
139
+ let result;
140
+ // collect all deps that starts with require keyword
141
+ result = lines.filter((line) => line.trim().startsWith("require") && !line.includes("(")).map((dep) => dep.substring("require".length).trim());
142
+ // collect all deps that are inside `require` blocks
143
+ let currentSegmentOfGoMod = goMod;
144
+ let requirePositionObject = decideRequireBlockIndex(currentSegmentOfGoMod);
145
+ while (requirePositionObject.index > -1) {
146
+ let depsInsideRequirementsBlock = currentSegmentOfGoMod.substring(requirePositionObject.index + requirePositionObject.startingOffeset).trim();
147
+ let endOfBlockIndex = depsInsideRequirementsBlock.indexOf(")");
148
+ let currentIndex = 0;
149
+ while (currentIndex < endOfBlockIndex) {
150
+ let endOfLinePosition = depsInsideRequirementsBlock.indexOf(EOL, currentIndex);
151
+ let dependency = depsInsideRequirementsBlock.substring(currentIndex, endOfLinePosition);
152
+ result.push(dependency.trim());
153
+ currentIndex = endOfLinePosition + 1;
154
+ }
155
+ currentSegmentOfGoMod = currentSegmentOfGoMod.substring(endOfBlockIndex + 1).trim();
156
+ requirePositionObject = decideRequireBlockIndex(currentSegmentOfGoMod);
157
+ }
158
+ function decideRequireBlockIndex(goMod) {
159
+ let object = {};
160
+ let index = goMod.indexOf("require(");
161
+ object.startingOffeset = "require(".length;
162
+ if (index === -1) {
163
+ index = goMod.indexOf("require (");
164
+ object.startingOffeset = "require (".length;
165
+ if (index === -1) {
166
+ index = goMod.indexOf("require (");
167
+ object.startingOffeset = "require (".length;
168
+ }
169
+ }
170
+ object.index = index;
171
+ return object;
172
+ }
173
+ return result;
174
+ }
175
+ /**
176
+ *
177
+ * @param {string} rootElementName the rootElementName element of go mod graph, to compare only direct deps from go mod graph against go.mod manifest
178
+ * @param{[string]} goModGraphOutputRows the goModGraphOutputRows from go mod graph' output
179
+ * @param {string }manifest path to go.mod manifest on file system
180
+ * @private
181
+ */
182
+ function performManifestVersionsCheck(rootElementName, goModGraphOutputRows, manifest) {
183
+ let goMod = fs.readFileSync(manifest).toString().trim();
184
+ let lines = goMod.split(getLineSeparatorGolang());
185
+ let comparisonLines = goModGraphOutputRows.filter((line) => line.startsWith(rootElementName)).map((line) => getChildVertexFromEdge(line));
186
+ let manifestDeps = collectAllDepsFromManifest(lines, goMod);
187
+ try {
188
+ comparisonLines.forEach((dependency) => {
189
+ let parts = dependency.split("@");
190
+ let version = parts[1];
191
+ let depName = parts[0];
192
+ manifestDeps.forEach(dep => {
193
+ let components = dep.trim().split(" ");
194
+ let currentDepName = components[0];
195
+ let currentVersion = components[1];
196
+ if (currentDepName === depName) {
197
+ if (currentVersion !== version) {
198
+ throw new Error(`versions mismatch for dependency name ${depName}, manifest version=${currentVersion}, installed Version=${version}, if you want to allow version mismatch for analysis between installed and requested packages, set environment variable/setting - MATCH_MANIFEST_VERSIONS=false`);
199
+ }
200
+ }
201
+ });
202
+ });
203
+ }
204
+ catch (error) {
205
+ console.error("Can't continue with analysis");
206
+ throw error;
207
+ }
208
+ }
209
+ /**
210
+ * Create SBOM json string for go Module.
211
+ * @param {string} manifest - path for go.mod
212
+ * @param {{}} [opts={}] - optional various options to pass along the application
213
+ * @param {boolean} includeTransitive - whether the sbom should contain transitive dependencies of the main module or not.
214
+ * @returns {string} the SBOM json content
215
+ * @private
216
+ */
217
+ function getSBOM(manifest, opts = {}, includeTransitive) {
218
+ // get custom goBin path
219
+ let goBin = getCustomPath('go', opts);
220
+ // verify goBin is accessible
221
+ try {
222
+ invokeCommand(goBin, ['version']);
223
+ }
224
+ catch (error) {
225
+ if (error.code === 'ENOENT') {
226
+ throw new Error(`go binary is not accessible at "${goBin}"`);
227
+ }
228
+ throw new Error(`failed to check for go binary`, { cause: error });
229
+ }
230
+ let manifestDir = path.dirname(manifest);
231
+ try {
232
+ var goGraphOutput = invokeCommand(goBin, ['mod', 'graph'], { cwd: manifestDir }).toString().trim();
233
+ }
234
+ catch (error) {
235
+ throw new Error('failed to invoke go binary for module graph', { cause: error });
236
+ }
237
+ try {
238
+ var goModEditOutput = JSON.parse(invokeCommand(goBin, ["mod", "edit", "-json"], { cwd: manifestDir }).toString().trim());
239
+ }
240
+ catch (error) {
241
+ throw new Error('failed to determine root module name', { cause: error });
242
+ }
243
+ let ignoredDeps = getIgnoredDeps(manifest);
244
+ let allIgnoredDeps = ignoredDeps.map((dep) => dep.toString());
245
+ let sbom = new Sbom();
246
+ let rows = goGraphOutput.split(getLineSeparatorGolang()).filter(line => !line.includes(' go@'));
247
+ let root = getParentVertexFromEdge(goModEditOutput['Module']['Path']);
248
+ let matchManifestVersions = getCustom("MATCH_MANIFEST_VERSIONS", "false", opts);
249
+ if (matchManifestVersions === "true") {
250
+ performManifestVersionsCheck(root, rows, manifest);
251
+ }
252
+ const mainModule = toPurl(root, "@");
253
+ sbom.addRoot(mainModule);
254
+ const exhortGoMvsLogicEnabled = getCustom("TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED", "true", opts);
255
+ if (includeTransitive && exhortGoMvsLogicEnabled === "true") {
256
+ rows = getFinalPackagesVersionsForModule(rows, manifest, goBin);
257
+ }
258
+ if (includeTransitive) {
259
+ let currentParent = "";
260
+ let source;
261
+ let rowsWithoutBlankRows = rows.filter(row => row.trim() !== "");
262
+ rowsWithoutBlankRows.forEach(row => {
263
+ if (getParentVertexFromEdge(row) !== currentParent) {
264
+ currentParent = getParentVertexFromEdge(row);
265
+ source = toPurl(currentParent, "@");
266
+ }
267
+ let target = toPurl(getChildVertexFromEdge(row), "@");
268
+ sbom.addDependency(source, target);
269
+ });
270
+ // at the end, filter out all ignored dependencies including versions.
271
+ sbom.filterIgnoredDepsIncludingVersion(allIgnoredDeps);
272
+ enforceRemovingIgnoredDepsInCaseOfAutomaticVersionUpdate(ignoredDeps, sbom);
273
+ }
274
+ else {
275
+ let directDependencies = rows.filter(row => row.startsWith(root));
276
+ directDependencies.forEach(pair => {
277
+ let dependency = getChildVertexFromEdge(pair);
278
+ let depPurl = toPurl(dependency, "@");
279
+ if (dependencyNotIgnored(ignoredDeps, depPurl)) {
280
+ sbom.addDependency(mainModule, depPurl);
281
+ }
282
+ });
283
+ enforceRemovingIgnoredDepsInCaseOfAutomaticVersionUpdate(ignoredDeps, sbom);
284
+ }
285
+ return sbom.getAsJsonString(opts);
286
+ }
287
+ /**
288
+ * Utility function for creating Purl String
289
+
290
+ * @param {string }dependency the name of the artifact, can include a namespace(group) or not - namespace/artifactName.
291
+ * @param {RegExp} delimiter delimiter between name of dependency and version
292
+ * @private
293
+ * @returns {PackageURL|null} PackageUrl Object ready to be used in SBOM
294
+ */
295
+ function toPurl(dependency, delimiter) {
296
+ let lastSlashIndex = dependency.lastIndexOf("/");
297
+ let pkg;
298
+ if (lastSlashIndex === -1) {
299
+ let splitParts = dependency.split(delimiter);
300
+ pkg = new PackageURL(ecosystem, undefined, splitParts[0], splitParts[1], undefined, undefined);
301
+ }
302
+ else {
303
+ let namespace = dependency.slice(0, lastSlashIndex);
304
+ let dependencyAndVersion = dependency.slice(lastSlashIndex + 1);
305
+ let parts = dependencyAndVersion.split(delimiter);
306
+ if (parts.length === 2) {
307
+ pkg = new PackageURL(ecosystem, namespace, parts[0], parts[1], undefined, undefined);
308
+ }
309
+ else {
310
+ pkg = new PackageURL(ecosystem, namespace, parts[0], defaultMainModuleVersion, undefined, undefined);
311
+ }
312
+ }
313
+ return pkg;
314
+ }
315
+ /** This function gets rows from go mod graph , and go.mod graph, and selecting for all
316
+ * packages the has more than one minor the final versions as selected by golang MVS algorithm.
317
+ * @param {[string]}rows all the rows from go modules dependency tree
318
+ * @param {string} manifestPath the path of the go.mod file
319
+ * @param {string} path to go binary
320
+ * @return {[string]} rows that contains final versions.
321
+ */
322
+ function getFinalPackagesVersionsForModule(rows, manifestPath, goBin) {
323
+ let manifestDir = path.dirname(manifestPath);
324
+ let options = { cwd: manifestDir };
325
+ // TODO: determine whether this is necessary
326
+ try {
327
+ invokeCommand(goBin, ['mod', 'download'], options);
328
+ var finalVersionsForAllModules = invokeCommand(goBin, ['list', '-m', 'all'], options).toString();
329
+ }
330
+ catch (error) {
331
+ throw new Error('failed to list all modules', { cause: error });
332
+ }
333
+ let finalVersionModules = new Map();
334
+ finalVersionsForAllModules.split(getLineSeparatorGolang()).filter(string => string.trim() !== "")
335
+ .filter(string => string.trim().split(" ").length === 2)
336
+ .forEach((dependency) => {
337
+ let dep = dependency.split(" ");
338
+ finalVersionModules[dep[0]] = dep[1];
339
+ });
340
+ let finalVersionModulesArray = new Array();
341
+ rows.filter(string => string.trim() !== "").forEach(module => {
342
+ let child = getChildVertexFromEdge(module);
343
+ let parent = getParentVertexFromEdge(module);
344
+ let parentName = getPackageName(parent);
345
+ let childName = getPackageName(child);
346
+ let parentFinalVersion = finalVersionModules[parentName];
347
+ let childFinalVersion = finalVersionModules[childName];
348
+ // Handle special cases for go and toolchain modules that aren't in go list -m all
349
+ if (isSpecialGoModule(parentName) || isSpecialGoModule(childName)) {
350
+ // For go and toolchain modules, use the original versions from the graph
351
+ let parentVersion = getVersionOfPackage(parent);
352
+ let childVersion = getVersionOfPackage(child);
353
+ if (parentName !== parent) {
354
+ finalVersionModulesArray.push(`${parentName}@${parentVersion} ${childName}@${childVersion}`);
355
+ }
356
+ else {
357
+ finalVersionModulesArray.push(`${parentName} ${childName}@${childVersion}`);
358
+ }
359
+ }
360
+ else {
361
+ // For regular modules, use MVS logic
362
+ if (parentName !== parent) {
363
+ finalVersionModulesArray.push(`${parentName}@${parentFinalVersion} ${childName}@${childFinalVersion}`);
364
+ }
365
+ else {
366
+ finalVersionModulesArray.push(`${parentName} ${childName}@${childFinalVersion}`);
367
+ }
368
+ }
369
+ });
370
+ return finalVersionModulesArray;
371
+ }
372
+ /**
373
+ *
374
+ * @param {string} fullPackage - full package with its name and version
375
+ * @return -{string} package name only
376
+ * @private
377
+ */
378
+ function getPackageName(fullPackage) {
379
+ return fullPackage.split("@")[0];
380
+ }
381
+ /**
382
+ * Check if a module name is a special Go module (go or toolchain)
383
+ * @param {string} moduleName - the module name to check
384
+ * @return {boolean} true if it's a special Go module
385
+ * @private
386
+ */
387
+ function isSpecialGoModule(moduleName) {
388
+ return moduleName === 'go' || moduleName === 'toolchain';
389
+ }
390
+ /**
391
+ *
392
+ * @param {string} fullPackage - full package with its name and version
393
+ * @return -{string} package version only
394
+ * @private
395
+ */
396
+ function getVersionOfPackage(fullPackage) {
397
+ let parts = fullPackage.split("@");
398
+ return parts.length > 1 ? parts[1] : undefined;
399
+ }
400
+ function getLineSeparatorGolang() {
401
+ let reg = /\n|\r\n/;
402
+ return reg;
403
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * This class provides common functionality for Groovy and Kotlin DSL files.
3
+ */
4
+ export default class Java_gradle extends Base_java {
5
+ constructor();
6
+ _getManifestName(): void;
7
+ _parseAliasForLibsNotation(): void;
8
+ _extractDepToBeIgnored(): void;
9
+ /**
10
+ * @param {string} manifestName - the subject manifest name-type
11
+ * @returns {boolean} - return true if the manifest name-type is the supported type (example build.gradle)
12
+ */
13
+ isSupported(manifestName: string): boolean;
14
+ /**
15
+ * @param {string} manifestDir - the directory where the manifest lies
16
+ */
17
+ validateLockFile(): boolean;
18
+ /**
19
+ * Provide content and content type for stack analysis.
20
+ * @param {string} manifest - the manifest path or name
21
+ * @param {{}} [opts={}] - optional various options to pass along the application
22
+ * @returns {Provided}
23
+ */
24
+ provideStack(manifest: string, opts?: {} | undefined): Provided;
25
+ /**
26
+ * Provide content and content type for maven-maven component analysis.
27
+ * @param {string} manifest - path to pom.xml for component report
28
+ * @param {{}} [opts={}] - optional various options to pass along the application
29
+ * @returns {Provided}
30
+ */
31
+ provideComponent(manifest: string, opts?: {} | undefined): Provided;
32
+ #private;
33
+ }
34
+ export type Provided = import('../provider.js').Provided;
35
+ import Base_java from "./base_java.js";