@cyclonedx/cyclonedx-library 9.2.0 → 9.4.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 (166) hide show
  1. package/dist.d/builders/index.node.d.ts +9 -1
  2. package/dist.d/builders/index.node.d.ts.map +1 -1
  3. package/dist.d/contrib/bom/index.d.ts +20 -0
  4. package/dist.d/contrib/bom/index.d.ts.map +1 -0
  5. package/dist.d/{utils/bomUtility.d.ts → contrib/bom/utils.d.ts} +1 -1
  6. package/dist.d/contrib/bom/utils.d.ts.map +1 -0
  7. package/dist.d/contrib/fromNodePackageJson/_helpers/gitUrl.d.ts.map +1 -0
  8. package/dist.d/contrib/fromNodePackageJson/_helpers/packageJson.d.ts.map +1 -0
  9. package/dist.d/{builders/fromNodePackageJson.node.d.ts → contrib/fromNodePackageJson/builders.d.ts} +18 -9
  10. package/dist.d/contrib/fromNodePackageJson/builders.d.ts.map +1 -0
  11. package/dist.d/{factories/fromNodePackageJson.node.d.ts → contrib/fromNodePackageJson/factories.d.ts} +5 -5
  12. package/dist.d/contrib/fromNodePackageJson/factories.d.ts.map +1 -0
  13. package/dist.d/contrib/fromNodePackageJson/index.node.d.ts +31 -0
  14. package/dist.d/contrib/fromNodePackageJson/index.node.d.ts.map +1 -0
  15. package/dist.d/{types/nodePackageJson.d.ts → contrib/fromNodePackageJson/types.d.ts} +1 -1
  16. package/dist.d/contrib/fromNodePackageJson/types.d.ts.map +1 -0
  17. package/dist.d/{utils/npmjsUtility.node.d.ts → contrib/fromNodePackageJson/utils.d.ts} +2 -2
  18. package/dist.d/contrib/fromNodePackageJson/utils.d.ts.map +1 -0
  19. package/dist.d/contrib/index.common.d.ts +24 -0
  20. package/dist.d/contrib/index.common.d.ts.map +1 -0
  21. package/dist.d/contrib/index.node.d.ts +25 -0
  22. package/dist.d/contrib/index.node.d.ts.map +1 -0
  23. package/dist.d/contrib/index.web.d.ts +24 -0
  24. package/dist.d/contrib/index.web.d.ts.map +1 -0
  25. package/dist.d/contrib/license/_helpers/mime.node.d.ts.map +1 -0
  26. package/dist.d/{factories/license.d.ts → contrib/license/factories.d.ts} +3 -3
  27. package/dist.d/contrib/license/factories.d.ts.map +1 -0
  28. package/dist.d/contrib/license/index.common.d.ts +20 -0
  29. package/dist.d/contrib/license/index.common.d.ts.map +1 -0
  30. package/dist.d/contrib/license/index.node.d.ts +21 -0
  31. package/dist.d/contrib/license/index.node.d.ts.map +1 -0
  32. package/dist.d/contrib/license/index.web.d.ts +20 -0
  33. package/dist.d/contrib/license/index.web.d.ts.map +1 -0
  34. package/dist.d/{utils/licenseUtility.node.d.ts → contrib/license/utils.node.d.ts} +2 -2
  35. package/dist.d/contrib/license/utils.node.d.ts.map +1 -0
  36. package/dist.d/{factories/packageUrl.d.ts → contrib/packageUrl/factories.d.ts} +2 -2
  37. package/dist.d/contrib/packageUrl/factories.d.ts.map +1 -0
  38. package/dist.d/contrib/packageUrl/index.d.ts +20 -0
  39. package/dist.d/contrib/packageUrl/index.d.ts.map +1 -0
  40. package/dist.d/factories/index.common.d.ts +18 -2
  41. package/dist.d/factories/index.common.d.ts.map +1 -1
  42. package/dist.d/factories/index.node.d.ts +9 -1
  43. package/dist.d/factories/index.node.d.ts.map +1 -1
  44. package/dist.d/index.node.d.ts +4 -0
  45. package/dist.d/index.node.d.ts.map +1 -1
  46. package/dist.d/index.web.d.ts +3 -0
  47. package/dist.d/index.web.d.ts.map +1 -1
  48. package/dist.d/types/index.d.ts +25 -1
  49. package/dist.d/types/index.d.ts.map +1 -1
  50. package/dist.d/utils/index.common.d.ts +9 -1
  51. package/dist.d/utils/index.common.d.ts.map +1 -1
  52. package/dist.d/utils/index.node.d.ts +18 -2
  53. package/dist.d/utils/index.node.d.ts.map +1 -1
  54. package/dist.node/builders/index.node.js +2 -1
  55. package/dist.node/builders/index.node.js.map +1 -1
  56. package/dist.node/contrib/bom/index.js +56 -0
  57. package/dist.node/contrib/bom/index.js.map +1 -0
  58. package/dist.node/{utils/bomUtility.js → contrib/bom/utils.js} +1 -1
  59. package/dist.node/contrib/bom/utils.js.map +1 -0
  60. package/dist.node/contrib/fromNodePackageJson/_helpers/gitUrl.js.map +1 -0
  61. package/dist.node/contrib/fromNodePackageJson/_helpers/packageJson.js.map +1 -0
  62. package/dist.node/{builders/fromNodePackageJson.node.js → contrib/fromNodePackageJson/builders.js} +7 -7
  63. package/dist.node/contrib/fromNodePackageJson/builders.js.map +1 -0
  64. package/dist.node/{factories/fromNodePackageJson.node.js → contrib/fromNodePackageJson/factories.js} +17 -17
  65. package/dist.node/contrib/fromNodePackageJson/factories.js.map +1 -0
  66. package/dist.node/contrib/fromNodePackageJson/index.node.js +59 -0
  67. package/dist.node/contrib/fromNodePackageJson/index.node.js.map +1 -0
  68. package/dist.node/{types/nodePackageJson.js → contrib/fromNodePackageJson/types.js} +1 -1
  69. package/dist.node/contrib/fromNodePackageJson/types.js.map +1 -0
  70. package/dist.node/{utils/npmjsUtility.node.js → contrib/fromNodePackageJson/utils.js} +2 -2
  71. package/dist.node/contrib/fromNodePackageJson/utils.js.map +1 -0
  72. package/dist.node/contrib/index.common.js +57 -0
  73. package/dist.node/contrib/index.common.js.map +1 -0
  74. package/dist.node/contrib/index.node.js +61 -0
  75. package/dist.node/contrib/index.node.js.map +1 -0
  76. package/dist.node/contrib/license/_helpers/mime.node.js.map +1 -0
  77. package/dist.node/{factories/license.js → contrib/license/factories.js} +3 -3
  78. package/dist.node/contrib/license/factories.js.map +1 -0
  79. package/dist.node/contrib/license/index.common.js +56 -0
  80. package/dist.node/contrib/license/index.common.js.map +1 -0
  81. package/dist.node/contrib/license/index.node.js +60 -0
  82. package/dist.node/contrib/license/index.node.js.map +1 -0
  83. package/dist.node/{utils/licenseUtility.node.js → contrib/license/utils.node.js} +4 -4
  84. package/dist.node/contrib/license/utils.node.js.map +1 -0
  85. package/dist.node/{factories/packageUrl.js → contrib/packageUrl/factories.js} +2 -2
  86. package/dist.node/contrib/packageUrl/factories.js.map +1 -0
  87. package/dist.node/contrib/packageUrl/index.js +56 -0
  88. package/dist.node/contrib/packageUrl/index.js.map +1 -0
  89. package/dist.node/factories/index.common.js +5 -16
  90. package/dist.node/factories/index.common.js.map +1 -1
  91. package/dist.node/factories/index.node.js +5 -4
  92. package/dist.node/factories/index.node.js.map +1 -1
  93. package/dist.node/index.node.js +2 -1
  94. package/dist.node/index.node.js.map +1 -1
  95. package/dist.node/types/index.js +4 -1
  96. package/dist.node/types/index.js.map +1 -1
  97. package/dist.node/utils/index.common.js +2 -1
  98. package/dist.node/utils/index.common.js.map +1 -1
  99. package/dist.node/utils/index.node.js +8 -6
  100. package/dist.node/utils/index.node.js.map +1 -1
  101. package/dist.web/lib.dev.js +622 -253
  102. package/dist.web/lib.dev.js.map +1 -1
  103. package/dist.web/lib.js +1 -1
  104. package/dist.web/lib.js.map +1 -1
  105. package/package.json +23 -3
  106. package/res/schema/README.md +3 -1
  107. package/src/builders/index.node.ts +15 -1
  108. package/src/contrib/README.md +20 -0
  109. package/src/contrib/bom/index.ts +20 -0
  110. package/src/contrib/fromNodePackageJson/_helpers/README.md +6 -0
  111. package/src/{builders/fromNodePackageJson.node.ts → contrib/fromNodePackageJson/builders.ts} +17 -16
  112. package/src/{factories/fromNodePackageJson.node.ts → contrib/fromNodePackageJson/factories.ts} +15 -15
  113. package/src/contrib/fromNodePackageJson/index.node.ts +34 -0
  114. package/src/{utils/npmjsUtility.node.ts → contrib/fromNodePackageJson/utils.ts} +1 -1
  115. package/src/contrib/index.common.ts +25 -0
  116. package/src/contrib/index.node.ts +31 -0
  117. package/src/contrib/index.web.ts +30 -0
  118. package/src/contrib/license/_helpers/README.md +6 -0
  119. package/src/{factories/license.ts → contrib/license/factories.ts} +3 -3
  120. package/src/contrib/license/index.common.ts +22 -0
  121. package/src/contrib/license/index.node.ts +28 -0
  122. package/src/contrib/license/index.web.ts +28 -0
  123. package/src/{utils/licenseUtility.node.ts → contrib/license/utils.node.ts} +3 -3
  124. package/src/{factories/packageUrl.ts → contrib/packageUrl/factories.ts} +2 -2
  125. package/src/contrib/packageUrl/index.ts +20 -0
  126. package/src/factories/index.common.ts +24 -3
  127. package/src/factories/index.node.ts +14 -1
  128. package/src/index.common.ts +1 -0
  129. package/src/index.node.ts +7 -0
  130. package/src/index.web.ts +6 -0
  131. package/src/types/index.ts +37 -2
  132. package/src/utils/index.common.ts +15 -1
  133. package/src/utils/index.node.ts +25 -2
  134. package/dist.d/_helpers/gitUrl.d.ts.map +0 -1
  135. package/dist.d/_helpers/mime.node.d.ts.map +0 -1
  136. package/dist.d/_helpers/packageJson.d.ts.map +0 -1
  137. package/dist.d/builders/fromNodePackageJson.node.d.ts.map +0 -1
  138. package/dist.d/factories/fromNodePackageJson.node.d.ts.map +0 -1
  139. package/dist.d/factories/license.d.ts.map +0 -1
  140. package/dist.d/factories/packageUrl.d.ts.map +0 -1
  141. package/dist.d/types/nodePackageJson.d.ts.map +0 -1
  142. package/dist.d/utils/bomUtility.d.ts.map +0 -1
  143. package/dist.d/utils/licenseUtility.node.d.ts.map +0 -1
  144. package/dist.d/utils/npmjsUtility.node.d.ts.map +0 -1
  145. package/dist.node/_helpers/gitUrl.js.map +0 -1
  146. package/dist.node/_helpers/mime.node.js.map +0 -1
  147. package/dist.node/_helpers/packageJson.js.map +0 -1
  148. package/dist.node/builders/fromNodePackageJson.node.js.map +0 -1
  149. package/dist.node/factories/fromNodePackageJson.node.js.map +0 -1
  150. package/dist.node/factories/license.js.map +0 -1
  151. package/dist.node/factories/packageUrl.js.map +0 -1
  152. package/dist.node/types/nodePackageJson.js.map +0 -1
  153. package/dist.node/utils/bomUtility.js.map +0 -1
  154. package/dist.node/utils/licenseUtility.node.js.map +0 -1
  155. package/dist.node/utils/npmjsUtility.node.js.map +0 -1
  156. /package/dist.d/{_helpers → contrib/fromNodePackageJson/_helpers}/gitUrl.d.ts +0 -0
  157. /package/dist.d/{_helpers → contrib/fromNodePackageJson/_helpers}/packageJson.d.ts +0 -0
  158. /package/dist.d/{_helpers → contrib/license/_helpers}/mime.node.d.ts +0 -0
  159. /package/dist.node/{_helpers → contrib/fromNodePackageJson/_helpers}/gitUrl.js +0 -0
  160. /package/dist.node/{_helpers → contrib/fromNodePackageJson/_helpers}/packageJson.js +0 -0
  161. /package/dist.node/{_helpers → contrib/license/_helpers}/mime.node.js +0 -0
  162. /package/src/{utils/bomUtility.ts → contrib/bom/utils.ts} +0 -0
  163. /package/src/{_helpers → contrib/fromNodePackageJson/_helpers}/gitUrl.ts +0 -0
  164. /package/src/{_helpers → contrib/fromNodePackageJson/_helpers}/packageJson.ts +0 -0
  165. /package/src/{types/nodePackageJson.ts → contrib/fromNodePackageJson/types.ts} +0 -0
  166. /package/src/{_helpers → contrib/license/_helpers}/mime.node.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclonedx/cyclonedx-library",
3
- "version": "9.2.0",
3
+ "version": "9.4.0",
4
4
  "description": "Core functionality of CycloneDX for JavaScript (Node.js or WebBrowser).",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -121,12 +121,12 @@
121
121
  "deepmerge": "^4.2.2",
122
122
  "fast-glob": "^3.3.1",
123
123
  "memfs": "^4.46.1",
124
- "mocha": "11.7.4",
124
+ "mocha": "11.7.5",
125
125
  "npm-run-all2": "^8",
126
126
  "rimraf": "^6",
127
127
  "ts-loader": "9.5.4",
128
128
  "typescript": "5.9.3",
129
- "webpack": "5.102.1",
129
+ "webpack": "5.103.0",
130
130
  "webpack-cli": "6.0.1",
131
131
  "webpack-node-externals": "3.0.0"
132
132
  },
@@ -182,6 +182,26 @@
182
182
  "./Validation": {
183
183
  "types": "./dist.d/validation/index.node.d.ts",
184
184
  "default": "./dist.node/validation/index.node.js"
185
+ },
186
+ "./Contrib": {
187
+ "types": "./dist.d/contrib/index.node.d.ts",
188
+ "default": "./dist.node/contrib/index.node.js"
189
+ },
190
+ "./Contrib/Bom": {
191
+ "types": "./dist.d/contrib/bom/index.d.ts",
192
+ "default": "./dist.node/contrib/bom/index.js"
193
+ },
194
+ "./Contrib/FromNodePackageJson": {
195
+ "types": "./dist.d/contrib/fromNodePackageJson/index.node.d.ts",
196
+ "default": "./dist.node/contrib/fromNodePackageJson/index.node.js"
197
+ },
198
+ "./Contrib/License": {
199
+ "types": "./dist.d/contrib/license/index.node.d.ts",
200
+ "default": "./dist.node/contrib/license/index.node.js"
201
+ },
202
+ "./Contrib/PackageUrl": {
203
+ "types": "./dist.d/contrib/packageUrl/index.d.ts",
204
+ "default": "./dist.node/contrib/packageUrl/index.js"
185
205
  }
186
206
  },
187
207
  "directories": {
@@ -21,12 +21,13 @@ Currently using version
21
21
  | [`bom-1.4.SNAPSHOT.schema.json`](bom-1.4.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
22
22
  | [`bom-1.5.SNAPSHOT.schema.json`](bom-1.5.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
23
23
  | [`bom-1.6.SNAPSHOT.schema.json`](bom-1.6.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
24
- | [`bom-1.7.SNAPSHOT.schema.json`](bom-1.7.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
24
+ | [`bom-1.7.SNAPSHOT.schema.json`](bom-1.7.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6,7 |
25
25
  | [`bom-1.2-strict.SNAPSHOT.schema.json`](bom-1.2-strict.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
26
26
  | [`bom-1.3-strict.SNAPSHOT.schema.json`](bom-1.3-strict.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
27
27
  | [`spdx.SNAPSHOT.xsd`](spdx.SNAPSHOT.xsd) | |
28
28
  | [`spdx.SNAPSHOT.schema.json`](spdx.SNAPSHOT.schema.json) | |
29
29
  | [`jsf-0.82.SNAPSHOT.schema.json`](jsf-0.82.SNAPSHOT.schema.json) | |
30
+ | [`cryptography-defs.SNAPSHOT.schema.json`](cryptography-defs.SNAPSHOT.schema.json) | |
30
31
 
31
32
  changes:
32
33
  1. `https?://cyclonedx.org/schema/spdx` was replaced with `spdx.SNAPSHOT.xsd`
@@ -35,3 +36,4 @@ changes:
35
36
  4. `properties.$schema.enum` was fixed to match `$id`
36
37
  5. `required.version` removed, as it is actually optional with default value
37
38
  6. `"format": "string"` removed, as it is unknown to JSON spec
39
+ 7. `cryptography-defs.schema.json` was replaced with `cryptography-defs.SNAPSHOT.schema.json`
@@ -17,4 +17,18 @@ SPDX-License-Identifier: Apache-2.0
17
17
  Copyright (c) OWASP Foundation. All Rights Reserved.
18
18
  */
19
19
 
20
- export * as FromNodePackageJson from './fromNodePackageJson.node'
20
+ import * as _FromNodePackageJson from '../contrib/fromNodePackageJson/builders'
21
+
22
+
23
+ // region deprecated re-exports
24
+
25
+ /**
26
+ * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Builders}.
27
+ *
28
+ * @deprecated This re-export location is deprecated.
29
+ * Import `Contrib.FromNodePackageJson.Builders` instead.
30
+ * The exported symbol itself is NOT deprecated - only this import path.
31
+ */
32
+ export const FromNodePackageJson = _FromNodePackageJson
33
+
34
+ // endregion deprecated re-exports
@@ -0,0 +1,20 @@
1
+ # CycloneDX Contrib Extensions
2
+
3
+ This directory contains community-contributed functionality that extends the capabilities of the CycloneDX core library.
4
+ Unlike the modules in `../`, these features are not part of the official CycloneDX specification and may vary in stability, scope, or compatibility.
5
+
6
+ ## Contents
7
+ - Utilities, helpers, and experimental features developed by the community
8
+ - Optional add-ons that may facilitate or enhance use of the CycloneDX core library
9
+ - Code that evolves independently of the CycloneDX specification
10
+
11
+ ## Notes
12
+ - Contrib modules are optional and not required for strict compliance with the CycloneDX standard.
13
+ - They may change more frequently than the core and are not guaranteed to follow the same versioning rules.
14
+ - Users should evaluate these modules carefully and consult documentation or source comments for details.
15
+
16
+ ## Contributing
17
+ Contributions are welcome. To add an extension:
18
+ 1. Follow the contribution guidelines in the main repository.
19
+ 2. Place your code in a clearly named subfolder or file under `contrib/`.
20
+ 3. Provide documentation and tests to ensure clarity and maintainability.
@@ -0,0 +1,20 @@
1
+ /*!
2
+ This file is part of CycloneDX JavaScript Library.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ SPDX-License-Identifier: Apache-2.0
17
+ Copyright (c) OWASP Foundation. All Rights Reserved.
18
+ */
19
+
20
+ export * as Utils from './utils'
@@ -0,0 +1,6 @@
1
+ # Helpers
2
+
3
+ These are _internal_ helpers, that are not intended to be exported/published.
4
+
5
+ The helpers SHALL **NOT** be marked as `@internal`, so that TypeScript might pick up on them and still render definitions for them.
6
+ The internal defined interfaces, classes, functions are required for proper type checking downstream, but SHOULD NOT be utilized/called downstream.
@@ -26,26 +26,27 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
26
26
  * Normalization should be done downstream, for example via [`normalize-package-data`](https://www.npmjs.com/package/normalize-package-data).
27
27
  */
28
28
 
29
- import { splitNameGroup } from '../_helpers/packageJson'
30
- import { ComponentType } from '../enums/componentType'
31
- import type * as Factories from '../factories/index.node'
32
- import { Component } from '../models/component'
33
- import { ExternalReferenceRepository } from '../models/externalReference'
34
- import { LicenseRepository } from '../models/license'
35
- import { Tool } from '../models/tool'
36
- import type { NodePackageJson } from '../types/nodePackageJson'
29
+ import { ComponentType } from '../../enums/componentType'
30
+ import { Component } from '../../models/component'
31
+ import { ExternalReferenceRepository } from '../../models/externalReference'
32
+ import { LicenseRepository } from '../../models/license'
33
+ import { Tool } from '../../models/tool'
34
+ import type { LicenseFactory } from '../license/factories'
35
+ import { splitNameGroup } from './_helpers/packageJson'
36
+ import type { ExternalReferenceFactory } from './factories'
37
+ import type { NodePackageJson } from './types'
37
38
 
38
39
  /**
39
40
  * Node-specific ToolBuilder.
40
41
  */
41
42
  export class ToolBuilder {
42
- readonly #extRefFactory: Factories.FromNodePackageJson.ExternalReferenceFactory
43
+ readonly #extRefFactory: ExternalReferenceFactory
43
44
 
44
45
  constructor (extRefFactory: ToolBuilder['extRefFactory']) {
45
46
  this.#extRefFactory = extRefFactory
46
47
  }
47
48
 
48
- get extRefFactory (): Factories.FromNodePackageJson.ExternalReferenceFactory {
49
+ get extRefFactory (): ExternalReferenceFactory {
49
50
  return this.#extRefFactory
50
51
  }
51
52
 
@@ -71,8 +72,8 @@ export class ToolBuilder {
71
72
  * Node-specific ComponentBuilder.
72
73
  */
73
74
  export class ComponentBuilder {
74
- readonly #extRefFactory: Factories.FromNodePackageJson.ExternalReferenceFactory
75
- readonly #licenseFactory: Factories.LicenseFactory
75
+ readonly #extRefFactory: ExternalReferenceFactory
76
+ readonly #licenseFactory: LicenseFactory
76
77
 
77
78
  constructor (
78
79
  extRefFactory: ComponentBuilder['extRefFactory'],
@@ -82,11 +83,11 @@ export class ComponentBuilder {
82
83
  this.#licenseFactory = licenseFactory
83
84
  }
84
85
 
85
- get extRefFactory (): Factories.FromNodePackageJson.ExternalReferenceFactory {
86
+ get extRefFactory (): ExternalReferenceFactory {
86
87
  return this.#extRefFactory
87
88
  }
88
89
 
89
- get licenseFactory (): Factories.LicenseFactory {
90
+ get licenseFactory (): LicenseFactory {
90
91
  return this.#licenseFactory
91
92
  }
92
93
 
@@ -104,8 +105,8 @@ export class ComponentBuilder {
104
105
  const author = typeof data.author === 'string'
105
106
  ? data.author
106
107
  : (typeof data.author?.name === 'string'
107
- ? data.author.name
108
- : undefined)
108
+ ? data.author.name
109
+ : undefined)
109
110
 
110
111
  /* see https://docs.npmjs.com/cli/v9/configuring-npm/package-json#description-1 */
111
112
  const description = typeof data.description === 'string'
@@ -29,16 +29,16 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
29
29
  import type { PackageURL } from 'packageurl-js'
30
30
  import { PurlQualifierNames } from 'packageurl-js'
31
31
 
32
- import { tryCanonicalizeGitUrl } from "../_helpers/gitUrl"
33
- import { isNotUndefined } from '../_helpers/notUndefined'
34
- import { ExternalReferenceType } from '../enums/externalReferenceType'
35
- import { HashAlgorithm } from "../enums/hashAlogorithm";
36
- import type { Component } from '../models/component'
37
- import { ExternalReference } from '../models/externalReference'
38
- import { HashDictionary } from '../models/hash'
39
- import type { NodePackageJson } from '../types/nodePackageJson'
40
- import { defaultRegistryMatcher, parsePackageIntegrity } from '../utils/npmjsUtility.node'
41
- import { PackageUrlFactory as PlainPackageUrlFactory } from './packageUrl'
32
+ import { isNotUndefined } from '../../_helpers/notUndefined'
33
+ import { ExternalReferenceType } from '../../enums/externalReferenceType'
34
+ import { HashAlgorithm } from '../../enums/hashAlogorithm'
35
+ import type { Component } from '../../models/component'
36
+ import { ExternalReference } from '../../models/externalReference'
37
+ import { HashDictionary } from '../../models/hash'
38
+ import { PackageUrlFactory as PlainPackageUrlFactory } from '../packageUrl/factories'
39
+ import { tryCanonicalizeGitUrl } from './_helpers/gitUrl'
40
+ import type { NodePackageJson } from './types'
41
+ import { defaultRegistryMatcher, parsePackageIntegrity } from './utils'
42
42
 
43
43
  /**
44
44
  * Node-specific ExternalReferenceFactory.
@@ -58,8 +58,8 @@ export class ExternalReferenceFactory {
58
58
  makeVcs (data: NodePackageJson): ExternalReference | undefined {
59
59
  /* see https://docs.npmjs.com/cli/v9/configuring-npm/package-json#repositoryc */
60
60
  const repository = data.repository
61
- let url = undefined
62
- let comment: string | undefined = undefined
61
+ let url // eslint-disable-line @typescript-eslint/init-declarations -- ack
62
+ let comment // eslint-disable-line @typescript-eslint/init-declarations -- ack
63
63
  if (typeof repository === 'object') {
64
64
  url = tryCanonicalizeGitUrl(repository.url)
65
65
  comment = 'as detected from PackageJson property "repository.url"'
@@ -91,8 +91,8 @@ export class ExternalReferenceFactory {
91
91
  makeIssueTracker (data: NodePackageJson): ExternalReference | undefined {
92
92
  /* see https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bugs */
93
93
  const bugs = data.bugs
94
- let url = undefined
95
- let comment: string | undefined = undefined
94
+ let url // eslint-disable-line @typescript-eslint/init-declarations -- ack
95
+ let comment // eslint-disable-line @typescript-eslint/init-declarations -- ack
96
96
  if (typeof bugs === 'object') {
97
97
  url = bugs.url
98
98
  comment = 'as detected from PackageJson property "bugs.url"'
@@ -122,7 +122,7 @@ export class ExternalReferenceFactory {
122
122
  } catch { /* pass */ }
123
123
  }
124
124
  if (typeof shasum === 'string' && shasum.length === 40) {
125
- hashes.set(HashAlgorithm["SHA-1"], shasum)
125
+ hashes.set(HashAlgorithm['SHA-1'], shasum)
126
126
  comment += ' and property "dist.shasum"'
127
127
  }
128
128
  return new ExternalReference(tarball, ExternalReferenceType.Distribution, { hashes, comment })
@@ -0,0 +1,34 @@
1
+ /*!
2
+ This file is part of CycloneDX JavaScript Library.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ SPDX-License-Identifier: Apache-2.0
17
+ Copyright (c) OWASP Foundation. All Rights Reserved.
18
+ */
19
+
20
+ /**
21
+ * Node-specifics.
22
+ *
23
+ * Intended to run on normalized data structures
24
+ * based on [PackageJson spec](https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/package.json)
25
+ * and explained by [PackageJson description](https://docs.npmjs.com/cli/v9/configuring-npm/package-json).
26
+ * Normalization should be done downstream, for example via [`normalize-package-data`](https://www.npmjs.com/package/normalize-package-data).
27
+ */
28
+
29
+ export * as Builders from './builders'
30
+ export * as Factories from './factories'
31
+ export * as Types from './types'
32
+ export * as Utils from './utils'
33
+
34
+ // do not export the _helpers, they are for internal use only
@@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0
17
17
  Copyright (c) OWASP Foundation. All Rights Reserved.
18
18
  */
19
19
 
20
- import {HashAlgorithm} from '../enums/hashAlogorithm'
20
+ import {HashAlgorithm} from '../../enums/hashAlogorithm'
21
21
 
22
22
  /**
23
23
  * See {@link https://docs.npmjs.com/cli/v9/configuring-npm/package-lock-json#packages | package lock docs} for "integrity".
@@ -0,0 +1,25 @@
1
+ /*!
2
+ This file is part of CycloneDX JavaScript Library.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ SPDX-License-Identifier: Apache-2.0
17
+ Copyright (c) OWASP Foundation. All Rights Reserved.
18
+ */
19
+
20
+ /**
21
+ * Some features in this library are marked as contrib. These are community-provided extensions and are not part of the official standard. They are optional and may evolve independently from the core.
22
+ */
23
+
24
+ export * as Bom from './bom'
25
+ export * as PackageUrl from './packageUrl'
@@ -0,0 +1,31 @@
1
+ /*!
2
+ This file is part of CycloneDX JavaScript Library.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ SPDX-License-Identifier: Apache-2.0
17
+ Copyright (c) OWASP Foundation. All Rights Reserved.
18
+ */
19
+
20
+ /**
21
+ * Some features in this library are marked as contrib. These are community-provided extensions and are not part of the official standard. They are optional and may evolve independently from the core.
22
+ */
23
+
24
+ export * from './index.common'
25
+
26
+ // region node-specifics
27
+
28
+ export * as FromNodePackageJson from './fromNodePackageJson/index.node'
29
+ export * as License from './license/index.node'
30
+
31
+ // endregion node-specifics
@@ -0,0 +1,30 @@
1
+ /*!
2
+ This file is part of CycloneDX JavaScript Library.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ SPDX-License-Identifier: Apache-2.0
17
+ Copyright (c) OWASP Foundation. All Rights Reserved.
18
+ */
19
+
20
+ /**
21
+ * Some features in this library are marked as contrib. These are community-provided extensions and are not part of the official standard. They are optional and may evolve independently from the core.
22
+ */
23
+
24
+ export * from './index.common'
25
+
26
+ // region web-specifics
27
+
28
+ export * as License from './license/index.web'
29
+
30
+ // endregion web-specifics
@@ -0,0 +1,6 @@
1
+ # Helpers
2
+
3
+ These are _internal_ helpers, that are not intended to be exported/published.
4
+
5
+ The helpers SHALL **NOT** be marked as `@internal`, so that TypeScript might pick up on them and still render definitions for them.
6
+ The internal defined interfaces, classes, functions are required for proper type checking downstream, but SHOULD NOT be utilized/called downstream.
@@ -17,9 +17,9 @@ SPDX-License-Identifier: Apache-2.0
17
17
  Copyright (c) OWASP Foundation. All Rights Reserved.
18
18
  */
19
19
 
20
- import type { DisjunctiveLicense, License } from '../models/license'
21
- import { LicenseExpression, NamedLicense, SpdxLicense } from '../models/license'
22
- import { fixupSpdxId, isValidSpdxLicenseExpression } from '../spdx'
20
+ import type { DisjunctiveLicense, License } from '../../models/license'
21
+ import { LicenseExpression, NamedLicense, SpdxLicense } from '../../models/license'
22
+ import { fixupSpdxId, isValidSpdxLicenseExpression } from '../../spdx'
23
23
 
24
24
  export class LicenseFactory {
25
25
  makeFromString (value: string): License {
@@ -0,0 +1,22 @@
1
+ /*!
2
+ This file is part of CycloneDX JavaScript Library.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ SPDX-License-Identifier: Apache-2.0
17
+ Copyright (c) OWASP Foundation. All Rights Reserved.
18
+ */
19
+
20
+ export * as Factories from './factories'
21
+
22
+ // do not export the _helpers, they are for internal use only
@@ -0,0 +1,28 @@
1
+ /*!
2
+ This file is part of CycloneDX JavaScript Library.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ SPDX-License-Identifier: Apache-2.0
17
+ Copyright (c) OWASP Foundation. All Rights Reserved.
18
+ */
19
+
20
+ export * from './index.common'
21
+
22
+ // region node-specifics
23
+
24
+ export * as Utils from './utils.node'
25
+
26
+ // endregion node-specifics
27
+
28
+ // do not export the _helpers, they are for internal use only
@@ -0,0 +1,28 @@
1
+ /*!
2
+ This file is part of CycloneDX JavaScript Library.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ SPDX-License-Identifier: Apache-2.0
17
+ Copyright (c) OWASP Foundation. All Rights Reserved.
18
+ */
19
+
20
+ export * from './index.common'
21
+
22
+ // region web-specifics
23
+
24
+ // nothing. yet ...
25
+
26
+ // endregion web-specifics
27
+
28
+ // do not export the _helpers, they are for internal use only
@@ -26,9 +26,9 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
26
26
 
27
27
  import type { Stats } from 'node:fs'
28
28
 
29
- import { guessMimeTypeForLicenseFile } from '../_helpers/mime.node'
30
- import { AttachmentEncoding } from '../enums/attachmentEncoding'
31
- import { Attachment } from '../models/attachment'
29
+ import { AttachmentEncoding } from '../../enums/attachmentEncoding'
30
+ import { Attachment } from '../../models/attachment'
31
+ import { guessMimeTypeForLicenseFile } from './_helpers/mime.node'
32
32
 
33
33
  export interface FsUtils<P extends string> {
34
34
  readdirSync: (path: P ) => P[]
@@ -19,8 +19,8 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
19
19
 
20
20
  import { PackageURL, PurlQualifierNames } from 'packageurl-js'
21
21
 
22
- import { ExternalReferenceType } from '../enums/externalReferenceType'
23
- import type { Component } from '../models/component'
22
+ import { ExternalReferenceType } from '../../enums/externalReferenceType'
23
+ import type { Component } from '../../models/component'
24
24
 
25
25
  export class PackageUrlFactory<PurlType extends PackageURL['type'] = PackageURL['type']> {
26
26
  readonly #type: PurlType
@@ -0,0 +1,20 @@
1
+ /*!
2
+ This file is part of CycloneDX JavaScript Library.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ SPDX-License-Identifier: Apache-2.0
17
+ Copyright (c) OWASP Foundation. All Rights Reserved.
18
+ */
19
+
20
+ export * as Factories from './factories'
@@ -17,7 +17,28 @@ SPDX-License-Identifier: Apache-2.0
17
17
  Copyright (c) OWASP Foundation. All Rights Reserved.
18
18
  */
19
19
 
20
- // not everything is public, yet
20
+ import {LicenseFactory as _LicenseFactory} from '../contrib/license/factories'
21
+ import {PackageUrlFactory as _PackageUrlFactory} from '../contrib/packageUrl/factories'
21
22
 
22
- export * from './license'
23
- export * from './packageUrl'
23
+
24
+ // region deprecated re-exports
25
+
26
+ /**
27
+ * Deprecated — Alias of {@link Contrib.License.Factories.LicenseFactory}.
28
+ *
29
+ * @deprecated This re-export location is deprecated.
30
+ * Import `Contrib.License.Factories.LicenseFactory` instead.
31
+ * The exported symbol itself is NOT deprecated - only this import path.
32
+ */
33
+ export const LicenseFactory = _LicenseFactory
34
+
35
+ /**
36
+ * Deprecated — Alias of {@link Contrib.PackageUrl.Factories.PackageUrlFactory}.
37
+ *
38
+ * @deprecated This re-export location is deprecated.
39
+ * Import `Contrib.PackageUrl.Factories.PackageUrlFactory` instead.
40
+ * The exported symbol itself is NOT deprecated - only this import path.
41
+ */
42
+ export const PackageUrlFactory = _PackageUrlFactory
43
+
44
+ // endregion deprecated re-exports
@@ -17,10 +17,23 @@ SPDX-License-Identifier: Apache-2.0
17
17
  Copyright (c) OWASP Foundation. All Rights Reserved.
18
18
  */
19
19
 
20
+ import * as _FromNodePackageJson from '../contrib/fromNodePackageJson/factories'
21
+
20
22
  export * from './index.common'
21
23
 
22
24
  // region node-specifics
23
25
 
24
- export * as FromNodePackageJson from './fromNodePackageJson.node'
26
+ // region deprecated re-exports
27
+
28
+ /**
29
+ * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Factories}.
30
+ *
31
+ * @deprecated This re-export location is deprecated.
32
+ * Import `Contrib.FromNodePackageJson.Factories` instead.
33
+ * The exported symbol itself is NOT deprecated - only this import path.
34
+ */
35
+ export const FromNodePackageJson = _FromNodePackageJson
36
+
37
+ // endregion deprecated re-exports
25
38
 
26
39
  // endregion node-specifics
@@ -22,4 +22,5 @@ export * as Models from './models'
22
22
  export * as SPDX from './spdx'
23
23
  export * as Spec from './spec'
24
24
  export * as Types from './types'
25
+
25
26
  // do not export the _helpers, they are for internal use only
package/src/index.node.ts CHANGED
@@ -25,9 +25,13 @@ export * from './index.common'
25
25
 
26
26
  // region node-specifics
27
27
 
28
+ /** @deprecated next */
28
29
  export * as Builders from './builders/index.node'
30
+ export * as Contrib from './contrib/index.node'
31
+ /** @deprecated next */
29
32
  export * as Factories from './factories/index.node'
30
33
  export * as Serialize from './serialize/index.node'
34
+ /** @deprecated next */
31
35
  export * as Utils from './utils/index.node'
32
36
  export * as Validation from './validation/index.node'
33
37
 
@@ -39,3 +43,6 @@ export * as Validation from './validation/index.node'
39
43
  export * as _Resources from './resources.node'
40
44
 
41
45
  // endregion node-specifics
46
+
47
+ // do not export the _helpers, they are for internal use only
48
+