@trustify-da/trustify-da-javascript-client 0.3.0-ea.a783c26 → 0.3.0-ea.ab5949f

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 (54) hide show
  1. package/dist/package.json +19 -20
  2. package/dist/src/analysis.d.ts +7 -7
  3. package/dist/src/cyclone_dx_sbom.d.ts +7 -1
  4. package/dist/src/cyclone_dx_sbom.js +29 -8
  5. package/dist/src/index.d.ts +69 -10
  6. package/dist/src/index.js +73 -6
  7. package/dist/src/license/index.d.ts +3 -3
  8. package/dist/src/license/index.js +4 -1
  9. package/dist/src/license/license_utils.js +4 -1
  10. package/dist/src/license/licenses_api.d.ts +2 -2
  11. package/dist/src/oci_image/images.d.ts +1 -1
  12. package/dist/src/oci_image/utils.d.ts +5 -5
  13. package/dist/src/provider.d.ts +4 -3
  14. package/dist/src/provider.js +3 -1
  15. package/dist/src/providers/base_java.d.ts +14 -12
  16. package/dist/src/providers/base_java.js +18 -44
  17. package/dist/src/providers/base_javascript.d.ts +20 -9
  18. package/dist/src/providers/base_javascript.js +10 -3
  19. package/dist/src/providers/base_pyproject.d.ts +15 -6
  20. package/dist/src/providers/base_pyproject.js +12 -4
  21. package/dist/src/providers/golang_gomodules.d.ts +11 -1
  22. package/dist/src/providers/golang_gomodules.js +65 -8
  23. package/dist/src/providers/java_gradle.d.ts +19 -0
  24. package/dist/src/providers/java_gradle.js +116 -2
  25. package/dist/src/providers/java_gradle_groovy.d.ts +1 -1
  26. package/dist/src/providers/java_gradle_kotlin.d.ts +1 -1
  27. package/dist/src/providers/java_maven.d.ts +10 -2
  28. package/dist/src/providers/java_maven.js +165 -1
  29. package/dist/src/providers/javascript_bun.d.ts +10 -0
  30. package/dist/src/providers/javascript_bun.js +100 -0
  31. package/dist/src/providers/javascript_npm.d.ts +6 -1
  32. package/dist/src/providers/javascript_pnpm.js +6 -2
  33. package/dist/src/providers/marker_evaluator.d.ts +14 -0
  34. package/dist/src/providers/marker_evaluator.js +191 -0
  35. package/dist/src/providers/processors/yarn_berry_processor.d.ts +2 -2
  36. package/dist/src/providers/processors/yarn_classic_processor.d.ts +2 -2
  37. package/dist/src/providers/python_controller.d.ts +5 -1
  38. package/dist/src/providers/python_controller.js +58 -4
  39. package/dist/src/providers/python_pip.d.ts +5 -0
  40. package/dist/src/providers/python_pip.js +5 -5
  41. package/dist/src/providers/python_pip_pyproject.js +3 -1
  42. package/dist/src/providers/python_poetry.d.ts +63 -8
  43. package/dist/src/providers/python_poetry.js +132 -21
  44. package/dist/src/providers/python_uv.d.ts +20 -1
  45. package/dist/src/providers/python_uv.js +122 -2
  46. package/dist/src/providers/rust_cargo.d.ts +6 -2
  47. package/dist/src/providers/rust_cargo.js +31 -4
  48. package/dist/src/sbom.d.ts +7 -1
  49. package/dist/src/sbom.js +4 -2
  50. package/dist/src/tools.d.ts +28 -2
  51. package/dist/src/tools.js +58 -0
  52. package/dist/src/workspace.d.ts +9 -0
  53. package/dist/src/workspace.js +1 -1
  54. package/package.json +20 -21
package/dist/src/tools.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { execFileSync } from "child_process";
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
2
4
  import { EOL } from "os";
3
5
  import { HttpsProxyAgent } from "https-proxy-agent";
4
6
  import { PackageURL } from "packageurl-js";
@@ -128,6 +130,62 @@ export function getGitRootDir(cwd) {
128
130
  return undefined;
129
131
  }
130
132
  }
133
+ /**
134
+ * Normalize a filesystem path, lowercasing on Windows for case-insensitive comparison.
135
+ *
136
+ * @param {string} thePath
137
+ * @returns {string}
138
+ */
139
+ export function normalizePath(thePath) {
140
+ const normalized = path.resolve(thePath).normalize();
141
+ return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
142
+ }
143
+ /**
144
+ * Walk up from `startDir` to `repoRoot` looking for an executable wrapper script.
145
+ *
146
+ * @param {string} startDir - Absolute directory to start from
147
+ * @param {string} wrapperName - Wrapper filename (e.g. `mvnw`, `gradlew`)
148
+ * @param {string} [repoRoot] - Stop boundary (defaults to git root or filesystem root)
149
+ * @returns {string | undefined}
150
+ */
151
+ export function traverseForWrapper(startDir, wrapperName, repoRoot = undefined) {
152
+ const currentDir = normalizePath(startDir);
153
+ repoRoot = repoRoot || getGitRootDir(currentDir) || path.parse(currentDir).root;
154
+ const wrapperPath = path.join(currentDir, wrapperName);
155
+ try {
156
+ fs.accessSync(wrapperPath, fs.constants.X_OK);
157
+ return wrapperPath;
158
+ }
159
+ catch {
160
+ const rootDir = path.parse(currentDir).root;
161
+ if (currentDir === repoRoot || currentDir === rootDir) {
162
+ return undefined;
163
+ }
164
+ const parentDir = path.dirname(currentDir);
165
+ if (parentDir === currentDir || parentDir === rootDir) {
166
+ return undefined;
167
+ }
168
+ return traverseForWrapper(parentDir, wrapperName, repoRoot);
169
+ }
170
+ }
171
+ /**
172
+ * Resolve a build-tool binary, preferring a wrapper when configured.
173
+ *
174
+ * @param {string} globalBinary - Global binary name (e.g. `mvn`, `gradle`)
175
+ * @param {string} localWrapper - Wrapper filename (e.g. `mvnw`, `gradlew.bat`)
176
+ * @param {string} startDir - Directory from which to start the wrapper search
177
+ * @param {import('./index.js').Options} [opts={}]
178
+ * @returns {string} Path to the resolved binary
179
+ */
180
+ export function resolveBinary(globalBinary, localWrapper, startDir, opts = {}) {
181
+ if (getWrapperPreference(globalBinary, opts)) {
182
+ const wrapper = traverseForWrapper(startDir, localWrapper);
183
+ if (wrapper !== undefined) {
184
+ return wrapper;
185
+ }
186
+ }
187
+ return getCustomPath(globalBinary, opts);
188
+ }
131
189
  /** this method invokes command string in a process in a synchronous way.
132
190
  * @param {string} bin - the command to be invoked
133
191
  * @param {Array<string>} args - the args to pass to the binary
@@ -42,6 +42,15 @@ export function discoverWorkspacePackages(workspaceRoot: string, opts?: {
42
42
  TRUSTIFY_DA_WORKSPACE_DISCOVERY_IGNORE?: string;
43
43
  [key: string]: unknown;
44
44
  }): Promise<string[]>;
45
+ /**
46
+ * Convert workspace glob patterns to manifest-file glob patterns,
47
+ * correctly handling negation prefixes.
48
+ *
49
+ * @param {string[]} patterns - Workspace glob patterns (may include negations)
50
+ * @param {string} manifestFileName - e.g. 'package.json' or 'Cargo.toml'
51
+ * @returns {string[]}
52
+ */
53
+ export function toManifestGlobPatterns(patterns: string[], manifestFileName: string): string[];
45
54
  /**
46
55
  * Discover all Cargo.toml manifest paths in a Cargo workspace.
47
56
  * Uses `cargo metadata` to get workspace members.
@@ -172,7 +172,7 @@ function parsePnpmPackages(content) {
172
172
  * @param {string} manifestFileName - e.g. 'package.json' or 'Cargo.toml'
173
173
  * @returns {string[]}
174
174
  */
175
- function toManifestGlobPatterns(patterns, manifestFileName) {
175
+ export function toManifestGlobPatterns(patterns, manifestFileName) {
176
176
  return patterns.map(p => {
177
177
  if (p.startsWith('!')) {
178
178
  return `!${p.slice(1)}/${manifestFileName}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustify-da/trustify-da-javascript-client",
3
- "version": "0.3.0-ea.a783c26",
3
+ "version": "0.3.0-ea.ab5949f",
4
4
  "description": "Code-Ready Dependency Analytics JavaScript API.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/guacsec/trustify-da-javascript-client#README.md",
@@ -35,8 +35,8 @@
35
35
  "config/**/*"
36
36
  ],
37
37
  "scripts": {
38
- "lint": "eslint src test --ext js",
39
- "lint:fix": "eslint src test --ext js --fix",
38
+ "lint": "eslint src test",
39
+ "lint:fix": "eslint src test --fix",
40
40
  "test": "c8 npm run tests",
41
41
  "tests": "mocha --config .mocharc.json",
42
42
  "tests:rep": "mocha --reporter-option maxDiffSize=0 --reporter json > unit-tests-result.json",
@@ -48,17 +48,17 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@babel/core": "^7.23.2",
51
- "@cyclonedx/cyclonedx-library": "^6.13.0",
51
+ "@cyclonedx/cyclonedx-library": "^10.0.0",
52
52
  "eslint-import-resolver-typescript": "^4.4.4",
53
53
  "fast-glob": "^3.3.3",
54
- "fast-toml": "^0.5.4",
55
54
  "fast-xml-parser": "^5.3.4",
56
55
  "help": "^3.0.2",
57
- "https-proxy-agent": "^7.0.6",
56
+ "https-proxy-agent": "^9.0.0",
58
57
  "js-yaml": "^4.1.1",
58
+ "jsonc-parser": "^3.3.1",
59
59
  "micromatch": "^4.0.8",
60
60
  "node-fetch": "^3.3.2",
61
- "p-limit": "^4.0.0",
61
+ "p-limit": "^7.3.0",
62
62
  "packageurl-js": "~1.0.2",
63
63
  "smol-toml": "^1.6.0",
64
64
  "tree-sitter-gomod": "github:strum355/tree-sitter-go-mod#56326f2ad478892ace58ff247a97d492a3cbcdda",
@@ -68,23 +68,24 @@
68
68
  },
69
69
  "devDependencies": {
70
70
  "@babel/core": "^7.23.2",
71
- "@trustify-da/trustify-da-api-model": "^2.0.7",
72
- "@types/node": "^20.17.30",
71
+ "@trustify-da/trustify-da-api-model": "^2.0.9",
72
+ "@types/node": "^25.9.1",
73
73
  "@types/which": "^3.0.4",
74
74
  "babel-plugin-rewire": "^1.2.0",
75
75
  "c8": "^11.0.0",
76
- "chai": "^4.3.7",
77
- "eslint": "^8.42.0",
76
+ "chai": "^6.2.2",
77
+ "@eslint/js": "^10.0.0",
78
+ "eslint": "^10.4.1",
78
79
  "eslint-import-resolver-typescript": "^4.4.4",
79
- "eslint-plugin-editorconfig": "^4.0.3",
80
- "eslint-plugin-import": "^2.29.1",
80
+ "eslint-plugin-import-x": "^4.16.2",
81
+ "globals": "^17.6.0",
81
82
  "esmock": "^2.6.2",
82
- "mocha": "^10.2.0",
83
+ "mocha": "^11.7.6",
83
84
  "msw": "^2.12.7",
84
- "sinon": "^15.1.2",
85
- "sinon-chai": "^3.7.0",
86
- "typescript": "^5.1.3",
87
- "which": "^5.0.0"
85
+ "sinon": "^22.0.0",
86
+ "sinon-chai": "^4.0.1",
87
+ "typescript": "^6.0.3",
88
+ "which": "^7.0.0"
88
89
  },
89
90
  "mocha": {
90
91
  "check-leaks": false,
@@ -112,12 +113,10 @@
112
113
  "reporter": [
113
114
  "html",
114
115
  "json",
116
+ "lcov",
115
117
  "text"
116
118
  ]
117
119
  },
118
- "eslintIgnore": [
119
- "index.js"
120
- ],
121
120
  "resolutions": {
122
121
  "@hapi/joi": "17.1.1"
123
122
  }