From 9e4d33d2d3ab7db0b1d32871293287601f0f3ae1 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 10:36:06 +0100 Subject: [PATCH 01/18] wip Signed-off-by: Jan Kowalleck --- package.json | 2 ++ src/builders/index.node.ts | 1 + src/factories/index.common.ts | 2 ++ src/factories/index.node.ts | 1 + src/utils/index.common.ts | 1 + src/utils/index.node.ts | 2 ++ 6 files changed, 9 insertions(+) diff --git a/package.json b/package.json index 26302877b..c5e4fc746 100644 --- a/package.json +++ b/package.json @@ -137,9 +137,11 @@ ".": { "types": { "browser": "./dist.d/index.web.d.ts", + "node": "./dist.d/index.node.d.ts", "default": "./dist.d/index.node.d.ts" }, "browser": "./dist.web/lib.js", + "node": "./dist.node/index.node.js", "default": "./dist.node/index.node.js" }, "./package.json": "./package.json", diff --git a/src/builders/index.node.ts b/src/builders/index.node.ts index 7ce7055ea..242df2f7d 100644 --- a/src/builders/index.node.ts +++ b/src/builders/index.node.ts @@ -30,5 +30,6 @@ import * as _FromNodePackageJson from '../contrib/fromNodePackageJson/builders' * The exported symbol itself is NOT deprecated - only this import path. */ export const FromNodePackageJson = _FromNodePackageJson +// export type FromNodePackageJson = typeof _FromNodePackageJson // endregion deprecated re-exports diff --git a/src/factories/index.common.ts b/src/factories/index.common.ts index 5569bc76a..a26a9a5f1 100644 --- a/src/factories/index.common.ts +++ b/src/factories/index.common.ts @@ -31,6 +31,7 @@ import {PackageUrlFactory as _PackageUrlFactory} from '../contrib/packageUrl/fac * The exported symbol itself is NOT deprecated - only this import path. */ export const LicenseFactory = _LicenseFactory +// export type LicenseFactory = typeof _LicenseFactory /** * Deprecated — Alias of {@link Contrib.PackageUrl.Factories.PackageUrlFactory}. @@ -40,5 +41,6 @@ export const LicenseFactory = _LicenseFactory * The exported symbol itself is NOT deprecated - only this import path. */ export const PackageUrlFactory = _PackageUrlFactory +// export type PackageUrlFactory = typeof _PackageUrlFactory // endregion deprecated re-exports diff --git a/src/factories/index.node.ts b/src/factories/index.node.ts index 99f79a102..f10671d9e 100644 --- a/src/factories/index.node.ts +++ b/src/factories/index.node.ts @@ -33,6 +33,7 @@ export * from './index.common' * The exported symbol itself is NOT deprecated - only this import path. */ export const FromNodePackageJson = _FromNodePackageJson +// export type FromNodePackageJson = typeof _FromNodePackageJson // endregion deprecated re-exports diff --git a/src/utils/index.common.ts b/src/utils/index.common.ts index 540e99673..cf7f8f2cf 100644 --- a/src/utils/index.common.ts +++ b/src/utils/index.common.ts @@ -29,6 +29,7 @@ import * as _BomUtils from '../contrib/bom/utils' * The exported symbol itself is NOT deprecated - only this import path. */ export const BomUtility = _BomUtils +// export type BomUtility = typeof _BomUtils // endregion deprecated re-exports diff --git a/src/utils/index.node.ts b/src/utils/index.node.ts index fbd9dbd99..76945536d 100644 --- a/src/utils/index.node.ts +++ b/src/utils/index.node.ts @@ -35,6 +35,7 @@ export * from './index.common' * The exported symbol itself is NOT deprecated - only this import path. */ export const NpmjsUtility = _NpmjsUtility +export type NpmjsUtility = typeof _NpmjsUtility /** * Deprecated — Alias of {@link Contrib.License.Utils}. @@ -44,6 +45,7 @@ export const NpmjsUtility = _NpmjsUtility * The exported symbol itself is NOT deprecated - only this import path. */ export const LicenseUtility = _LicenseUtility +// export type LicenseUtility = typeof _LicenseUtility // endregion deprecated re-exports From 782931878cd047ebacdc016b8ca79b36fc241ffc Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 12:52:10 +0100 Subject: [PATCH 02/18] fix: fix type exports Signed-off-by: Jan Kowalleck --- .../typescript/example.cjs/src/deprecated.ts | 52 +++++++++++++++++++ .../node/typescript/example.cjs/tsconfig.json | 3 +- .../typescript/example.mjs/src/deprecated.ts | 52 +++++++++++++++++++ .../node/typescript/example.mjs/tsconfig.json | 3 +- src/builders/fromNodePackageJson.node.ts | 48 +++++++++++++++++ src/builders/index.node.ts | 18 +------ src/factories/fromNodePackageJson.node.ts | 38 ++++++++++++++ src/factories/index.common.ts | 31 ++--------- src/factories/index.node.ts | 17 +----- src/factories/license.ts | 29 +++++++++++ src/factories/packageUrl.ts | 30 +++++++++++ src/utils/index.common.ts | 1 - src/utils/index.node.ts | 2 - 13 files changed, 262 insertions(+), 62 deletions(-) create mode 100644 examples/node/typescript/example.cjs/src/deprecated.ts create mode 100644 examples/node/typescript/example.mjs/src/deprecated.ts create mode 100644 src/builders/fromNodePackageJson.node.ts create mode 100644 src/factories/fromNodePackageJson.node.ts create mode 100644 src/factories/license.ts create mode 100644 src/factories/packageUrl.ts diff --git a/examples/node/typescript/example.cjs/src/deprecated.ts b/examples/node/typescript/example.cjs/src/deprecated.ts new file mode 100644 index 000000000..61fbc8612 --- /dev/null +++ b/examples/node/typescript/example.cjs/src/deprecated.ts @@ -0,0 +1,52 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + +/** + * Example showcasing the deprecated symbolsstillwork. + * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 + */ + +import * as CDX from '@cyclonedx/cyclonedx-library' +// full Library is available as `CDX`, now + + +const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() + + +const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher +const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') + +const dTnpj1: CDX.Types.NodePackageJson = {} +try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } +try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } + +type dF1_T = CDX.Factories.PackageUrlFactory +type dF2_T = CDX.Factories.LicenseFactory +const dF1: dF1_T = new CDX.Factories.PackageUrlFactory('generic') +const dF2: dF2_T = new CDX.Factories.LicenseFactory() + +type dFnpj3_T = CDX.Factories.FromNodePackageJson.PackageUrlFactory +const dFnpj3: dFnpj3_T = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') +type dFnpj4_T = CDX.Factories.FromNodePackageJson.ExternalReferenceFactory +const dFnpj4: dFnpj4_T = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() + +type dBnpj1_T = CDX.Builders.FromNodePackageJson.ComponentBuilder +const dBnpj1: dBnpj1_T = new CDX.Builders.FromNodePackageJson.ComponentBuilder(dFnpj4, dF2) +type dBnpj2_T = CDX.Builders.FromNodePackageJson.ToolBuilder +const dBnpj2: dBnpj2_T = new CDX.Builders.FromNodePackageJson.ToolBuilder(dFnpj4) diff --git a/examples/node/typescript/example.cjs/tsconfig.json b/examples/node/typescript/example.cjs/tsconfig.json index 85d4ea238..752f534ae 100644 --- a/examples/node/typescript/example.cjs/tsconfig.json +++ b/examples/node/typescript/example.cjs/tsconfig.json @@ -10,6 +10,7 @@ "rootDir": "src" }, "files": [ - "./src/example.ts" + "./src/example.ts", + "./src/deprecated.ts" ] } diff --git a/examples/node/typescript/example.mjs/src/deprecated.ts b/examples/node/typescript/example.mjs/src/deprecated.ts new file mode 100644 index 000000000..61fbc8612 --- /dev/null +++ b/examples/node/typescript/example.mjs/src/deprecated.ts @@ -0,0 +1,52 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + +/** + * Example showcasing the deprecated symbolsstillwork. + * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 + */ + +import * as CDX from '@cyclonedx/cyclonedx-library' +// full Library is available as `CDX`, now + + +const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() + + +const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher +const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') + +const dTnpj1: CDX.Types.NodePackageJson = {} +try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } +try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } + +type dF1_T = CDX.Factories.PackageUrlFactory +type dF2_T = CDX.Factories.LicenseFactory +const dF1: dF1_T = new CDX.Factories.PackageUrlFactory('generic') +const dF2: dF2_T = new CDX.Factories.LicenseFactory() + +type dFnpj3_T = CDX.Factories.FromNodePackageJson.PackageUrlFactory +const dFnpj3: dFnpj3_T = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') +type dFnpj4_T = CDX.Factories.FromNodePackageJson.ExternalReferenceFactory +const dFnpj4: dFnpj4_T = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() + +type dBnpj1_T = CDX.Builders.FromNodePackageJson.ComponentBuilder +const dBnpj1: dBnpj1_T = new CDX.Builders.FromNodePackageJson.ComponentBuilder(dFnpj4, dF2) +type dBnpj2_T = CDX.Builders.FromNodePackageJson.ToolBuilder +const dBnpj2: dBnpj2_T = new CDX.Builders.FromNodePackageJson.ToolBuilder(dFnpj4) diff --git a/examples/node/typescript/example.mjs/tsconfig.json b/examples/node/typescript/example.mjs/tsconfig.json index 04210e251..07139a702 100644 --- a/examples/node/typescript/example.mjs/tsconfig.json +++ b/examples/node/typescript/example.mjs/tsconfig.json @@ -10,6 +10,7 @@ "rootDir": "src" }, "files": [ - "./src/example.ts" + "./src/example.ts", + "./src/deprecated.ts" ] } diff --git a/src/builders/fromNodePackageJson.node.ts b/src/builders/fromNodePackageJson.node.ts new file mode 100644 index 000000000..c8554a40a --- /dev/null +++ b/src/builders/fromNodePackageJson.node.ts @@ -0,0 +1,48 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + +/** + * Node-specifics. + * + * Intended to run on normalized data structures + * based on [PackageJson spec](https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/package.json) + * and explained by [PackageJson description](https://docs.npmjs.com/cli/v9/configuring-npm/package-json). + * Normalization should be done downstream, for example via [`normalize-package-data`](https://www.npmjs.com/package/normalize-package-data). + */ + +import {ToolBuilder as _ToolBuilder, ComponentBuilder as _ComponentBuilder} from '../contrib/fromNodePackageJson/builders' + + +/** + * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Builders.ToolBuilder}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.FromNodePackageJson.Builders.ToolBuilder` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export class ToolBuilder extends _ToolBuilder {} + +/** + * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Builders.ComponentBuilder}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.FromNodePackageJson.Builders.ComponentBuilder` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export class ComponentBuilder extends _ComponentBuilder {} diff --git a/src/builders/index.node.ts b/src/builders/index.node.ts index 242df2f7d..966982a9e 100644 --- a/src/builders/index.node.ts +++ b/src/builders/index.node.ts @@ -17,19 +17,5 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import * as _FromNodePackageJson from '../contrib/fromNodePackageJson/builders' - - -// region deprecated re-exports - -/** - * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Builders}. - * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Builders` instead. - * The exported symbol itself is NOT deprecated - only this import path. - */ -export const FromNodePackageJson = _FromNodePackageJson -// export type FromNodePackageJson = typeof _FromNodePackageJson - -// endregion deprecated re-exports +/** @deprecated next */ +export * as FromNodePackageJson from './fromNodePackageJson.node' diff --git a/src/factories/fromNodePackageJson.node.ts b/src/factories/fromNodePackageJson.node.ts new file mode 100644 index 000000000..add39df3e --- /dev/null +++ b/src/factories/fromNodePackageJson.node.ts @@ -0,0 +1,38 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + +import { PackageUrlFactory as _PackageUrlFactory, ExternalReferenceFactory as _ExternalReferenceFactory } from '../contrib/fromNodePackageJson/factories' + +/** + * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Factories.PackageUrlFactory}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.FromNodePackageJson.Factories.PackageUrlFactory` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export class ExternalReferenceFactory extends _ExternalReferenceFactory {} + +/** + * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Factories.PackageUrlFactory}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.FromNodePackageJson.Factories.PackageUrlFactory` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export class PackageUrlFactory extends _PackageUrlFactory {} diff --git a/src/factories/index.common.ts b/src/factories/index.common.ts index a26a9a5f1..3fc5f7029 100644 --- a/src/factories/index.common.ts +++ b/src/factories/index.common.ts @@ -17,30 +17,9 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import {LicenseFactory as _LicenseFactory} from '../contrib/license/factories' -import {PackageUrlFactory as _PackageUrlFactory} from '../contrib/packageUrl/factories' +// not everything is public, yet - -// region deprecated re-exports - -/** - * Deprecated — Alias of {@link Contrib.License.Factories.LicenseFactory}. - * - * @deprecated This re-export location is deprecated. - * Import `Contrib.License.Factories.LicenseFactory` instead. - * The exported symbol itself is NOT deprecated - only this import path. - */ -export const LicenseFactory = _LicenseFactory -// export type LicenseFactory = typeof _LicenseFactory - -/** - * Deprecated — Alias of {@link Contrib.PackageUrl.Factories.PackageUrlFactory}. - * - * @deprecated This re-export location is deprecated. - * Import `Contrib.PackageUrl.Factories.PackageUrlFactory` instead. - * The exported symbol itself is NOT deprecated - only this import path. - */ -export const PackageUrlFactory = _PackageUrlFactory -// export type PackageUrlFactory = typeof _PackageUrlFactory - -// endregion deprecated re-exports +/** @deprecated next */ +export * from './license' +/** @deprecated next */ +export * from './packageUrl' diff --git a/src/factories/index.node.ts b/src/factories/index.node.ts index f10671d9e..2df6c8d2a 100644 --- a/src/factories/index.node.ts +++ b/src/factories/index.node.ts @@ -17,24 +17,11 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import * as _FromNodePackageJson from '../contrib/fromNodePackageJson/factories' - export * from './index.common' // region node-specifics -// region deprecated re-exports - -/** - * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Factories}. - * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Factories` instead. - * The exported symbol itself is NOT deprecated - only this import path. - */ -export const FromNodePackageJson = _FromNodePackageJson -// export type FromNodePackageJson = typeof _FromNodePackageJson - -// endregion deprecated re-exports +/** @deprecated next */ +export * as FromNodePackageJson from './fromNodePackageJson.node' // endregion node-specifics diff --git a/src/factories/license.ts b/src/factories/license.ts new file mode 100644 index 000000000..dd084defe --- /dev/null +++ b/src/factories/license.ts @@ -0,0 +1,29 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + +import {LicenseFactory as _LicenseFactory} from '../contrib/license/factories' + +/** + * Deprecated — Alias of {@link Contrib.License.Factories.LicenseFactory}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.License.Factories.LicenseFactory` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export class LicenseFactory extends _LicenseFactory {} diff --git a/src/factories/packageUrl.ts b/src/factories/packageUrl.ts new file mode 100644 index 000000000..08b2f5646 --- /dev/null +++ b/src/factories/packageUrl.ts @@ -0,0 +1,30 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + + +import { PackageUrlFactory as _PackageUrlFactory } from '../contrib/packageUrl/factories' + +/** + * Deprecated — Alias of {@link Contrib.PackageUrl.Factories.PackageUrlFactory}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.PackageUrl.Factories.PackageUrlFactory` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export class PackageUrlFactory extends _PackageUrlFactory {} diff --git a/src/utils/index.common.ts b/src/utils/index.common.ts index cf7f8f2cf..540e99673 100644 --- a/src/utils/index.common.ts +++ b/src/utils/index.common.ts @@ -29,7 +29,6 @@ import * as _BomUtils from '../contrib/bom/utils' * The exported symbol itself is NOT deprecated - only this import path. */ export const BomUtility = _BomUtils -// export type BomUtility = typeof _BomUtils // endregion deprecated re-exports diff --git a/src/utils/index.node.ts b/src/utils/index.node.ts index 76945536d..fbd9dbd99 100644 --- a/src/utils/index.node.ts +++ b/src/utils/index.node.ts @@ -35,7 +35,6 @@ export * from './index.common' * The exported symbol itself is NOT deprecated - only this import path. */ export const NpmjsUtility = _NpmjsUtility -export type NpmjsUtility = typeof _NpmjsUtility /** * Deprecated — Alias of {@link Contrib.License.Utils}. @@ -45,7 +44,6 @@ export type NpmjsUtility = typeof _NpmjsUtility * The exported symbol itself is NOT deprecated - only this import path. */ export const LicenseUtility = _LicenseUtility -// export type LicenseUtility = typeof _LicenseUtility // endregion deprecated re-exports From dbf759f9ae732dcb059a4453b5cab77426d121f2 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 12:59:04 +0100 Subject: [PATCH 03/18] docs Signed-off-by: Jan Kowalleck --- HISTORY.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index eb29c9df4..129871490 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,17 @@ All notable changes to this project will be documented in this file. +* Fixed + * Type declarations for deprecated symbols support usage as type, again ([#1350] via [#1351]) +* Refactor + * Some of the deprecated symbols in `factories` and `builders` turned from re-exports into class extensions (via [#]) + Note: this change adds overhead for the sake of documentation. + +[#1350]: https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 +[#1351]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1351 + +## 9.4.0 -- 2025-12-02 + * Added * New entry points for `/Contrib` and known submodules (via [#1343]) See `package.json::exports` for details. From d0845813ac8958f39a77370d05d6ad04d65f26c0 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 12:59:33 +0100 Subject: [PATCH 04/18] docs Signed-off-by: Jan Kowalleck --- HISTORY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 129871490..06c8d3f8c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,7 +9,7 @@ All notable changes to this project will be documented in this file. * Fixed * Type declarations for deprecated symbols support usage as type, again ([#1350] via [#1351]) * Refactor - * Some of the deprecated symbols in `factories` and `builders` turned from re-exports into class extensions (via [#]) + * Some of the deprecated symbols in `factories` and `builders` turned from re-exports into class extensions (via [#1351]) Note: this change adds overhead for the sake of documentation. [#1350]: https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 From a2697cd588bc5433316990b7c7a7cc2046b65880 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 12:59:47 +0100 Subject: [PATCH 05/18] style Signed-off-by: Jan Kowalleck --- src/builders/fromNodePackageJson.node.ts | 2 +- src/factories/fromNodePackageJson.node.ts | 2 +- src/factories/packageUrl.ts | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/builders/fromNodePackageJson.node.ts b/src/builders/fromNodePackageJson.node.ts index c8554a40a..425749f45 100644 --- a/src/builders/fromNodePackageJson.node.ts +++ b/src/builders/fromNodePackageJson.node.ts @@ -26,7 +26,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. * Normalization should be done downstream, for example via [`normalize-package-data`](https://www.npmjs.com/package/normalize-package-data). */ -import {ToolBuilder as _ToolBuilder, ComponentBuilder as _ComponentBuilder} from '../contrib/fromNodePackageJson/builders' +import {ComponentBuilder as _ComponentBuilder,ToolBuilder as _ToolBuilder} from '../contrib/fromNodePackageJson/builders' /** diff --git a/src/factories/fromNodePackageJson.node.ts b/src/factories/fromNodePackageJson.node.ts index add39df3e..87c072502 100644 --- a/src/factories/fromNodePackageJson.node.ts +++ b/src/factories/fromNodePackageJson.node.ts @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import { PackageUrlFactory as _PackageUrlFactory, ExternalReferenceFactory as _ExternalReferenceFactory } from '../contrib/fromNodePackageJson/factories' +import { ExternalReferenceFactory as _ExternalReferenceFactory,PackageUrlFactory as _PackageUrlFactory } from '../contrib/fromNodePackageJson/factories' /** * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Factories.PackageUrlFactory}. diff --git a/src/factories/packageUrl.ts b/src/factories/packageUrl.ts index 08b2f5646..91542221f 100644 --- a/src/factories/packageUrl.ts +++ b/src/factories/packageUrl.ts @@ -17,7 +17,6 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ - import { PackageUrlFactory as _PackageUrlFactory } from '../contrib/packageUrl/factories' /** From e90193001755aed9b9925931d1a255637d617c59 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 13:04:38 +0100 Subject: [PATCH 06/18] examples Signed-off-by: Jan Kowalleck --- .github/workflows/nodejs.yml | 3 ++ examples/node/javascript/.gitignore | 2 + examples/node/javascript/deprecated.cjs | 45 +++++++++++++++++++ examples/node/javascript/deprecated.mjs | 45 +++++++++++++++++++ .../node/typescript/example.cjs/package.json | 2 +- .../node/typescript/example.mjs/package.json | 2 +- 6 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 examples/node/javascript/deprecated.cjs create mode 100644 examples/node/javascript/deprecated.mjs diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 11da553df..5f65fe9cd 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -352,6 +352,9 @@ jobs: - name: run example run: node -- 'example.${{ matrix.js-type }}' working-directory: ${{ env.EXAMPLE_DIR }} + - name: run example + run: node -- 'deprecated.${{ matrix.js-type }}' + working-directory: ${{ env.EXAMPLE_DIR }} example-TS: needs: [ 'build' ] diff --git a/examples/node/javascript/.gitignore b/examples/node/javascript/.gitignore index 2594a7fd7..0fc3a3fb8 100644 --- a/examples/node/javascript/.gitignore +++ b/examples/node/javascript/.gitignore @@ -2,5 +2,7 @@ !/.gitignore !/example.mjs !/example.cjs +!/deprecated.cjs +!/deprecated.mjs !/package.json !/.npmrc diff --git a/examples/node/javascript/deprecated.cjs b/examples/node/javascript/deprecated.cjs new file mode 100644 index 000000000..27a69d9af --- /dev/null +++ b/examples/node/javascript/deprecated.cjs @@ -0,0 +1,45 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + +/** + * Example showcasing the deprecated symbolsstillwork. + * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 + */ + +const CDX = require('@cyclonedx/cyclonedx-library') +// full Library is available as `CDX`, now + +const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() + +const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher +const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') + +/** @type {CDX.Types.NodePackageJson} */ +const dTnpj1 = {} +try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } +try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } + +const dF1 = new CDX.Factories.PackageUrlFactory('generic') +const dF2 = new CDX.Factories.LicenseFactory() + +const dFnpj3 = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') +const dFnpj4 = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() + +const dBnpj1 = new CDX.Builders.FromNodePackageJson.ComponentBuilder(dFnpj4, dF2) +const dBnpj2 = new CDX.Builders.FromNodePackageJson.ToolBuilder(dFnpj4) diff --git a/examples/node/javascript/deprecated.mjs b/examples/node/javascript/deprecated.mjs new file mode 100644 index 000000000..1d0daffb7 --- /dev/null +++ b/examples/node/javascript/deprecated.mjs @@ -0,0 +1,45 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + +/** + * Example showcasing the deprecated symbolsstillwork. + * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 + */ + +import * as CDX from '@cyclonedx/cyclonedx-library' +// full Library is available as `CDX`, now + +const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() + +const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher +const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') + +/** @type {CDX.Types.NodePackageJson} */ +const dTnpj1 = {} +try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } +try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } + +const dF1 = new CDX.Factories.PackageUrlFactory('generic') +const dF2 = new CDX.Factories.LicenseFactory() + +const dFnpj3 = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') +const dFnpj4 = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() + +const dBnpj1 = new CDX.Builders.FromNodePackageJson.ComponentBuilder(dFnpj4, dF2) +const dBnpj2 = new CDX.Builders.FromNodePackageJson.ToolBuilder(dFnpj4) diff --git a/examples/node/typescript/example.cjs/package.json b/examples/node/typescript/example.cjs/package.json index d9c1885b5..098ad2c92 100644 --- a/examples/node/typescript/example.cjs/package.json +++ b/examples/node/typescript/example.cjs/package.json @@ -23,6 +23,6 @@ "scripts": { "prebuild": "tsc -b --clean", "build": "tsc -b", - "example": "node dist/example.js" + "example": "node dist/example.js; node dist/deprecated.js; " } } diff --git a/examples/node/typescript/example.mjs/package.json b/examples/node/typescript/example.mjs/package.json index 742e6753d..89184abe5 100644 --- a/examples/node/typescript/example.mjs/package.json +++ b/examples/node/typescript/example.mjs/package.json @@ -23,6 +23,6 @@ "scripts": { "prebuild": "tsc -b --clean", "build": "tsc -b", - "example": "node dist/example.js" + "example": "node dist/example.js; node dist/deprecated.js" } } From bdd3196985b4b6fdeb9518ce6558bff1c285d35a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 13:05:33 +0100 Subject: [PATCH 07/18] examples Signed-off-by: Jan Kowalleck --- examples/node/javascript/deprecated.cjs | 2 +- examples/node/javascript/deprecated.mjs | 2 +- examples/node/typescript/example.cjs/src/deprecated.ts | 2 +- examples/node/typescript/example.mjs/src/deprecated.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/node/javascript/deprecated.cjs b/examples/node/javascript/deprecated.cjs index 27a69d9af..40ba45a31 100644 --- a/examples/node/javascript/deprecated.cjs +++ b/examples/node/javascript/deprecated.cjs @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ /** - * Example showcasing the deprecated symbolsstillwork. + * Example showcasing the deprecated symbols still work. * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 */ diff --git a/examples/node/javascript/deprecated.mjs b/examples/node/javascript/deprecated.mjs index 1d0daffb7..fd4d8d57b 100644 --- a/examples/node/javascript/deprecated.mjs +++ b/examples/node/javascript/deprecated.mjs @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ /** - * Example showcasing the deprecated symbolsstillwork. + * Example showcasing the deprecated symbols still work. * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 */ diff --git a/examples/node/typescript/example.cjs/src/deprecated.ts b/examples/node/typescript/example.cjs/src/deprecated.ts index 61fbc8612..0aeecadf4 100644 --- a/examples/node/typescript/example.cjs/src/deprecated.ts +++ b/examples/node/typescript/example.cjs/src/deprecated.ts @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ /** - * Example showcasing the deprecated symbolsstillwork. + * Example showcasing the deprecated symbols still work. * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 */ diff --git a/examples/node/typescript/example.mjs/src/deprecated.ts b/examples/node/typescript/example.mjs/src/deprecated.ts index 61fbc8612..0aeecadf4 100644 --- a/examples/node/typescript/example.mjs/src/deprecated.ts +++ b/examples/node/typescript/example.mjs/src/deprecated.ts @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ /** - * Example showcasing the deprecated symbolsstillwork. + * Example showcasing the deprecated symbols still work. * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 */ From 49738a6b04d580f1f6da05e58933a30e5a387e39 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 13:35:24 +0100 Subject: [PATCH 08/18] dings Signed-off-by: Jan Kowalleck --- examples/node/javascript/deprecated.cjs | 5 ++ examples/node/javascript/deprecated.mjs | 5 ++ .../typescript/example.cjs/src/deprecated.ts | 8 ++ .../typescript/example.mjs/src/deprecated.ts | 8 ++ src/utils/bomUtility.ts | 29 +++++++ src/utils/index.common.ts | 17 +--- src/utils/index.node.ts | 29 +------ src/utils/licenseUtility.node.ts | 77 +++++++++++++++++++ src/utils/npmjsUtility.node.ts | 38 +++++++++ 9 files changed, 176 insertions(+), 40 deletions(-) create mode 100644 src/utils/bomUtility.ts create mode 100644 src/utils/licenseUtility.node.ts create mode 100644 src/utils/npmjsUtility.node.ts diff --git a/examples/node/javascript/deprecated.cjs b/examples/node/javascript/deprecated.cjs index 40ba45a31..05beecb6b 100644 --- a/examples/node/javascript/deprecated.cjs +++ b/examples/node/javascript/deprecated.cjs @@ -22,6 +22,9 @@ Copyright (c) OWASP Foundation. All Rights Reserved. * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 */ +const fs = require('node:fs') +const path = require('node:path') + const CDX = require('@cyclonedx/cyclonedx-library') // full Library is available as `CDX`, now @@ -30,6 +33,8 @@ const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') +const dLU1 = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs, path}) + /** @type {CDX.Types.NodePackageJson} */ const dTnpj1 = {} try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } diff --git a/examples/node/javascript/deprecated.mjs b/examples/node/javascript/deprecated.mjs index fd4d8d57b..717887f42 100644 --- a/examples/node/javascript/deprecated.mjs +++ b/examples/node/javascript/deprecated.mjs @@ -22,6 +22,9 @@ Copyright (c) OWASP Foundation. All Rights Reserved. * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 */ +import * as fs from 'node:fs' +import * as path from 'node:path' + import * as CDX from '@cyclonedx/cyclonedx-library' // full Library is available as `CDX`, now @@ -30,6 +33,8 @@ const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') +const dLU1 = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs, path}) + /** @type {CDX.Types.NodePackageJson} */ const dTnpj1 = {} try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } diff --git a/examples/node/typescript/example.cjs/src/deprecated.ts b/examples/node/typescript/example.cjs/src/deprecated.ts index 0aeecadf4..e27a42ed8 100644 --- a/examples/node/typescript/example.cjs/src/deprecated.ts +++ b/examples/node/typescript/example.cjs/src/deprecated.ts @@ -22,6 +22,9 @@ Copyright (c) OWASP Foundation. All Rights Reserved. * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 */ +import * as fs from 'node:fs' +import * as path from 'node:path' + import * as CDX from '@cyclonedx/cyclonedx-library' // full Library is available as `CDX`, now @@ -32,6 +35,11 @@ const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') +type dLU1_T = CDX.Utils.LicenseUtility.LicenseEvidenceGatherer +const fsU: CDX.Utils.LicenseUtility.FsUtils = fs +const pathU: CDX.Utils.LicenseUtility.PathUtils = path +const dLU1 = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs: fsU, path: pathU}) + const dTnpj1: CDX.Types.NodePackageJson = {} try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } diff --git a/examples/node/typescript/example.mjs/src/deprecated.ts b/examples/node/typescript/example.mjs/src/deprecated.ts index 0aeecadf4..e27a42ed8 100644 --- a/examples/node/typescript/example.mjs/src/deprecated.ts +++ b/examples/node/typescript/example.mjs/src/deprecated.ts @@ -22,6 +22,9 @@ Copyright (c) OWASP Foundation. All Rights Reserved. * @see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 */ +import * as fs from 'node:fs' +import * as path from 'node:path' + import * as CDX from '@cyclonedx/cyclonedx-library' // full Library is available as `CDX`, now @@ -32,6 +35,11 @@ const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') +type dLU1_T = CDX.Utils.LicenseUtility.LicenseEvidenceGatherer +const fsU: CDX.Utils.LicenseUtility.FsUtils = fs +const pathU: CDX.Utils.LicenseUtility.PathUtils = path +const dLU1 = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs: fsU, path: pathU}) + const dTnpj1: CDX.Types.NodePackageJson = {} try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } diff --git a/src/utils/bomUtility.ts b/src/utils/bomUtility.ts new file mode 100644 index 000000000..303e4d587 --- /dev/null +++ b/src/utils/bomUtility.ts @@ -0,0 +1,29 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + +import { randomSerialNumber as _randomSerialNumber } from '../contrib/bom/utils' + +/** + * Deprecated — Alias of {@link Contrib.Bom.Utils.randomSerialNumber}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.Bom.Utils.randomSerialNumber` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export const randomSerialNumber = _randomSerialNumber diff --git a/src/utils/index.common.ts b/src/utils/index.common.ts index 540e99673..f4078895a 100644 --- a/src/utils/index.common.ts +++ b/src/utils/index.common.ts @@ -17,18 +17,5 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -// region deprecated re-exports - -import * as _BomUtils from '../contrib/bom/utils' - -/** - * Deprecated — Alias of {@link Contrib.Bom.Utils}. - * - * @deprecated This re-export location is deprecated. - * Import `Contrib.Bom.Utils` instead. - * The exported symbol itself is NOT deprecated - only this import path. - */ -export const BomUtility = _BomUtils - -// endregion deprecated re-exports - +/** @deprecated next */ +export * as BomUtility from './bomUtility' diff --git a/src/utils/index.node.ts b/src/utils/index.node.ts index fbd9dbd99..d427df44f 100644 --- a/src/utils/index.node.ts +++ b/src/utils/index.node.ts @@ -17,34 +17,13 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import * as _NpmjsUtility from '../contrib/fromNodePackageJson/utils' -import * as _LicenseUtility from '../contrib/license/utils.node' - - export * from './index.common' // region node-specifics -// region deprecated re-exports - -/** - * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Utils}. - * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Utils` instead. - * The exported symbol itself is NOT deprecated - only this import path. - */ -export const NpmjsUtility = _NpmjsUtility - -/** - * Deprecated — Alias of {@link Contrib.License.Utils}. - * - * @deprecated This re-export location is deprecated. - * Import `Contrib.License.Utils` instead. - * The exported symbol itself is NOT deprecated - only this import path. - */ -export const LicenseUtility = _LicenseUtility - -// endregion deprecated re-exports +/** @deprecated next */ +export * as LicenseUtility from './licenseUtility.node' +/** @deprecated next */ +export * as NpmjsUtility from './npmjsUtility.node' // endregion node-specifics diff --git a/src/utils/licenseUtility.node.ts b/src/utils/licenseUtility.node.ts new file mode 100644 index 000000000..f950eba49 --- /dev/null +++ b/src/utils/licenseUtility.node.ts @@ -0,0 +1,77 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + +/** + * This module tries to be as compatible as possible, it only uses basic methods that are known to be working in all FileSystem abstraction-layers. + * In addition, we use type parameters for all `PathLike`s, so downstream users can utilize their implementations accordingly. + * + * @module + */ + +import { LicenseEvidenceGatherer as _LicenseEvidenceGatherer, + type ErrorReporter as _ErrorReporter, + FileAttachment as _FileAttachment, + PathUtils as _PathUtils, + FsUtils as _FsUtils +} from '../contrib/license/utils.node' + +/** + * Deprecated — TypeAlias of {@link Contrib.License.Utils.FsUtils}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.License.Utils.FsUtils` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export interface FsUtils

extends _FsUtils

{} + +/** + * Deprecated — TypeAlias of {@link Contrib.License.Utils.PathUtils}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.License.Utils.PathUtils` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export interface PathUtils

extends _PathUtils

{} + +/** + * Deprecated — TypeAlias of {@link Contrib.License.Utils.FileAttachment}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.License.Utils.FileAttachment` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export interface FileAttachment

extends _FileAttachment

{} + +/** + * Deprecated — TypeAlias of {@link Contrib.License.Utils.ErrorReporter}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.License.Utils.ErrorReporter` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export type ErrorReporter = _ErrorReporter + +/** + * Deprecated — Alias of {@link Contrib.License.Utils.LicenseEvidenceGatherer}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.License.Utils.LicenseEvidenceGatherer` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export class LicenseEvidenceGatherer extends _LicenseEvidenceGatherer {} diff --git a/src/utils/npmjsUtility.node.ts b/src/utils/npmjsUtility.node.ts new file mode 100644 index 000000000..39f79ab91 --- /dev/null +++ b/src/utils/npmjsUtility.node.ts @@ -0,0 +1,38 @@ +/*! +This file is part of CycloneDX JavaScript Library. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ + +import {parsePackageIntegrity as _parsePackageIntegrity, defaultRegistryMatcher as _defaultRegistryMatcher} from '../contrib/fromNodePackageJson/utils' + +/** + * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Utils.parsePackageIntegrity}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.FromNodePackageJson.Utils.parsePackageIntegrity` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export const parsePackageIntegrity = _parsePackageIntegrity + +/** + * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Utils.defaultRegistryMatcher}. + * + * @deprecated This re-export location is deprecated. + * Import `Contrib.FromNodePackageJson.Utils.defaultRegistryMatcher` instead. + * The exported symbol itself is NOT deprecated - only this import path. + */ +export const defaultRegistryMatcher = _defaultRegistryMatcher From 7940ef3b5a011c2218a2cc31a2095fa2b6f3af0a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 13:43:10 +0100 Subject: [PATCH 09/18] dings Signed-off-by: Jan Kowalleck --- src/builders/fromNodePackageJson.node.ts | 2 -- src/factories/fromNodePackageJson.node.ts | 2 -- src/factories/license.ts | 1 - src/factories/packageUrl.ts | 1 - src/types/index.ts | 5 +---- src/utils/licenseUtility.node.ts | 14 +++----------- src/utils/npmjsUtility.node.ts | 4 +--- 7 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/builders/fromNodePackageJson.node.ts b/src/builders/fromNodePackageJson.node.ts index 425749f45..95d48b225 100644 --- a/src/builders/fromNodePackageJson.node.ts +++ b/src/builders/fromNodePackageJson.node.ts @@ -34,7 +34,6 @@ import {ComponentBuilder as _ComponentBuilder,ToolBuilder as _ToolBuilder} from * * @deprecated This re-export location is deprecated. * Import `Contrib.FromNodePackageJson.Builders.ToolBuilder` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export class ToolBuilder extends _ToolBuilder {} @@ -43,6 +42,5 @@ export class ToolBuilder extends _ToolBuilder {} * * @deprecated This re-export location is deprecated. * Import `Contrib.FromNodePackageJson.Builders.ComponentBuilder` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export class ComponentBuilder extends _ComponentBuilder {} diff --git a/src/factories/fromNodePackageJson.node.ts b/src/factories/fromNodePackageJson.node.ts index 87c072502..c068332c9 100644 --- a/src/factories/fromNodePackageJson.node.ts +++ b/src/factories/fromNodePackageJson.node.ts @@ -24,7 +24,6 @@ import { ExternalReferenceFactory as _ExternalReferenceFactory,PackageUrlFactory * * @deprecated This re-export location is deprecated. * Import `Contrib.FromNodePackageJson.Factories.PackageUrlFactory` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export class ExternalReferenceFactory extends _ExternalReferenceFactory {} @@ -33,6 +32,5 @@ export class ExternalReferenceFactory extends _ExternalReferenceFactory {} * * @deprecated This re-export location is deprecated. * Import `Contrib.FromNodePackageJson.Factories.PackageUrlFactory` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export class PackageUrlFactory extends _PackageUrlFactory {} diff --git a/src/factories/license.ts b/src/factories/license.ts index dd084defe..2bbe8d052 100644 --- a/src/factories/license.ts +++ b/src/factories/license.ts @@ -24,6 +24,5 @@ import {LicenseFactory as _LicenseFactory} from '../contrib/license/factories' * * @deprecated This re-export location is deprecated. * Import `Contrib.License.Factories.LicenseFactory` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export class LicenseFactory extends _LicenseFactory {} diff --git a/src/factories/packageUrl.ts b/src/factories/packageUrl.ts index 91542221f..1e2641601 100644 --- a/src/factories/packageUrl.ts +++ b/src/factories/packageUrl.ts @@ -24,6 +24,5 @@ import { PackageUrlFactory as _PackageUrlFactory } from '../contrib/packageUrl/f * * @deprecated This re-export location is deprecated. * Import `Contrib.PackageUrl.Factories.PackageUrlFactory` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export class PackageUrlFactory extends _PackageUrlFactory {} diff --git a/src/types/index.ts b/src/types/index.ts index 5a9c94979..4f029aa7a 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -32,11 +32,10 @@ export * from './mimeType' // region deprecated re-exports /** - * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Types.NodePackageJson}. + * Deprecated — TypeAlias of {@link Contrib.FromNodePackageJson.Types.NodePackageJson}. * * @deprecated This re-export location is deprecated. * Import `Contrib.FromNodePackageJson.Types.NodePackageJson` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export type NodePackageJson = _NodePackageJson @@ -45,7 +44,6 @@ export type NodePackageJson = _NodePackageJson * * @deprecated This re-export location is deprecated. * Import `Contrib.FromNodePackageJson.Types.assertNodePackageJson` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export const assertNodePackageJson = _assertNodePackageJson @@ -54,7 +52,6 @@ export const assertNodePackageJson = _assertNodePackageJson * * @deprecated This re-export location is deprecated. * Import `Contrib.FromNodePackageJson.Types.isNodePackageJson` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export const isNodePackageJson = _isNodePackageJson diff --git a/src/utils/licenseUtility.node.ts b/src/utils/licenseUtility.node.ts index f950eba49..d50377eac 100644 --- a/src/utils/licenseUtility.node.ts +++ b/src/utils/licenseUtility.node.ts @@ -24,19 +24,15 @@ Copyright (c) OWASP Foundation. All Rights Reserved. * @module */ -import { LicenseEvidenceGatherer as _LicenseEvidenceGatherer, - type ErrorReporter as _ErrorReporter, - FileAttachment as _FileAttachment, - PathUtils as _PathUtils, - FsUtils as _FsUtils -} from '../contrib/license/utils.node' +import type { ErrorReporter as _ErrorReporter, FileAttachment as _FileAttachment, FsUtils as _FsUtils, PathUtils as _PathUtils} from '../contrib/license/utils.node'; +import { LicenseEvidenceGatherer as _LicenseEvidenceGatherer } from '../contrib/license/utils.node'; + /** * Deprecated — TypeAlias of {@link Contrib.License.Utils.FsUtils}. * * @deprecated This re-export location is deprecated. * Import `Contrib.License.Utils.FsUtils` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export interface FsUtils

extends _FsUtils

{} @@ -45,7 +41,6 @@ export interface FsUtils

extends _FsUtils

{} * * @deprecated This re-export location is deprecated. * Import `Contrib.License.Utils.PathUtils` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export interface PathUtils

extends _PathUtils

{} @@ -54,7 +49,6 @@ export interface PathUtils

extends _PathUtils

{} * * @deprecated This re-export location is deprecated. * Import `Contrib.License.Utils.FileAttachment` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export interface FileAttachment

extends _FileAttachment

{} @@ -63,7 +57,6 @@ export interface FileAttachment

extends _FileAttachment

{} * * @deprecated This re-export location is deprecated. * Import `Contrib.License.Utils.ErrorReporter` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export type ErrorReporter = _ErrorReporter @@ -72,6 +65,5 @@ export type ErrorReporter = _ErrorReporter * * @deprecated This re-export location is deprecated. * Import `Contrib.License.Utils.LicenseEvidenceGatherer` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export class LicenseEvidenceGatherer extends _LicenseEvidenceGatherer {} diff --git a/src/utils/npmjsUtility.node.ts b/src/utils/npmjsUtility.node.ts index 39f79ab91..2e151f957 100644 --- a/src/utils/npmjsUtility.node.ts +++ b/src/utils/npmjsUtility.node.ts @@ -17,14 +17,13 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import {parsePackageIntegrity as _parsePackageIntegrity, defaultRegistryMatcher as _defaultRegistryMatcher} from '../contrib/fromNodePackageJson/utils' +import {defaultRegistryMatcher as _defaultRegistryMatcher, parsePackageIntegrity as _parsePackageIntegrity} from '../contrib/fromNodePackageJson/utils' /** * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Utils.parsePackageIntegrity}. * * @deprecated This re-export location is deprecated. * Import `Contrib.FromNodePackageJson.Utils.parsePackageIntegrity` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export const parsePackageIntegrity = _parsePackageIntegrity @@ -33,6 +32,5 @@ export const parsePackageIntegrity = _parsePackageIntegrity * * @deprecated This re-export location is deprecated. * Import `Contrib.FromNodePackageJson.Utils.defaultRegistryMatcher` instead. - * The exported symbol itself is NOT deprecated - only this import path. */ export const defaultRegistryMatcher = _defaultRegistryMatcher From 9e721b0ed42f527903cbae9244b0d2862fb68cde Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 13:47:11 +0100 Subject: [PATCH 10/18] dings Signed-off-by: Jan Kowalleck --- src/builders/fromNodePackageJson.node.ts | 6 ++---- src/factories/fromNodePackageJson.node.ts | 6 ++---- src/factories/license.ts | 3 +-- src/factories/packageUrl.ts | 3 +-- src/types/index.ts | 9 +++------ src/utils/bomUtility.ts | 4 +--- src/utils/licenseUtility.node.ts | 15 +++++---------- src/utils/npmjsUtility.node.ts | 6 ++---- 8 files changed, 17 insertions(+), 35 deletions(-) diff --git a/src/builders/fromNodePackageJson.node.ts b/src/builders/fromNodePackageJson.node.ts index 95d48b225..ebf06b729 100644 --- a/src/builders/fromNodePackageJson.node.ts +++ b/src/builders/fromNodePackageJson.node.ts @@ -32,15 +32,13 @@ import {ComponentBuilder as _ComponentBuilder,ToolBuilder as _ToolBuilder} from /** * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Builders.ToolBuilder}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Builders.ToolBuilder` instead. + * @deprecated Use `Contrib.FromNodePackageJson.Builders.ToolBuilder` instead. */ export class ToolBuilder extends _ToolBuilder {} /** * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Builders.ComponentBuilder}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Builders.ComponentBuilder` instead. + * @deprecated Use `Contrib.FromNodePackageJson.Builders.ComponentBuilder` instead. */ export class ComponentBuilder extends _ComponentBuilder {} diff --git a/src/factories/fromNodePackageJson.node.ts b/src/factories/fromNodePackageJson.node.ts index c068332c9..a54cc30b0 100644 --- a/src/factories/fromNodePackageJson.node.ts +++ b/src/factories/fromNodePackageJson.node.ts @@ -22,15 +22,13 @@ import { ExternalReferenceFactory as _ExternalReferenceFactory,PackageUrlFactory /** * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Factories.PackageUrlFactory}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Factories.PackageUrlFactory` instead. + * @deprecated Use `Contrib.FromNodePackageJson.Factories.PackageUrlFactory` instead. */ export class ExternalReferenceFactory extends _ExternalReferenceFactory {} /** * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Factories.PackageUrlFactory}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Factories.PackageUrlFactory` instead. + * @deprecated Use `Contrib.FromNodePackageJson.Factories.PackageUrlFactory` instead. */ export class PackageUrlFactory extends _PackageUrlFactory {} diff --git a/src/factories/license.ts b/src/factories/license.ts index 2bbe8d052..7765ed4fe 100644 --- a/src/factories/license.ts +++ b/src/factories/license.ts @@ -22,7 +22,6 @@ import {LicenseFactory as _LicenseFactory} from '../contrib/license/factories' /** * Deprecated — Alias of {@link Contrib.License.Factories.LicenseFactory}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.License.Factories.LicenseFactory` instead. + * @deprecated Use `Contrib.License.Factories.LicenseFactory` instead. */ export class LicenseFactory extends _LicenseFactory {} diff --git a/src/factories/packageUrl.ts b/src/factories/packageUrl.ts index 1e2641601..c8ed16131 100644 --- a/src/factories/packageUrl.ts +++ b/src/factories/packageUrl.ts @@ -22,7 +22,6 @@ import { PackageUrlFactory as _PackageUrlFactory } from '../contrib/packageUrl/f /** * Deprecated — Alias of {@link Contrib.PackageUrl.Factories.PackageUrlFactory}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.PackageUrl.Factories.PackageUrlFactory` instead. + * @deprecated Use `Contrib.PackageUrl.Factories.PackageUrlFactory` instead. */ export class PackageUrlFactory extends _PackageUrlFactory {} diff --git a/src/types/index.ts b/src/types/index.ts index 4f029aa7a..31d681610 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -34,24 +34,21 @@ export * from './mimeType' /** * Deprecated — TypeAlias of {@link Contrib.FromNodePackageJson.Types.NodePackageJson}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Types.NodePackageJson` instead. + * @deprecated Use `Contrib.FromNodePackageJson.Types.NodePackageJson` instead. */ export type NodePackageJson = _NodePackageJson /** * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Types.assertNodePackageJson}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Types.assertNodePackageJson` instead. + * @deprecated Use `Contrib.FromNodePackageJson.Types.assertNodePackageJson` instead. */ export const assertNodePackageJson = _assertNodePackageJson /** * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Types.isNodePackageJson}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Types.isNodePackageJson` instead. + * @deprecated Use `Contrib.FromNodePackageJson.Types.isNodePackageJson` instead. */ export const isNodePackageJson = _isNodePackageJson diff --git a/src/utils/bomUtility.ts b/src/utils/bomUtility.ts index 303e4d587..9222e160a 100644 --- a/src/utils/bomUtility.ts +++ b/src/utils/bomUtility.ts @@ -22,8 +22,6 @@ import { randomSerialNumber as _randomSerialNumber } from '../contrib/bom/utils' /** * Deprecated — Alias of {@link Contrib.Bom.Utils.randomSerialNumber}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.Bom.Utils.randomSerialNumber` instead. - * The exported symbol itself is NOT deprecated - only this import path. + * @deprecated Use `Contrib.Bom.Utils.randomSerialNumber` instead. */ export const randomSerialNumber = _randomSerialNumber diff --git a/src/utils/licenseUtility.node.ts b/src/utils/licenseUtility.node.ts index d50377eac..7e31d89ec 100644 --- a/src/utils/licenseUtility.node.ts +++ b/src/utils/licenseUtility.node.ts @@ -31,39 +31,34 @@ import { LicenseEvidenceGatherer as _LicenseEvidenceGatherer } from '../contrib/ /** * Deprecated — TypeAlias of {@link Contrib.License.Utils.FsUtils}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.License.Utils.FsUtils` instead. + * @deprecated Use `Contrib.License.Utils.FsUtils` instead. */ export interface FsUtils

extends _FsUtils

{} /** * Deprecated — TypeAlias of {@link Contrib.License.Utils.PathUtils}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.License.Utils.PathUtils` instead. + * @deprecated Use `Contrib.License.Utils.PathUtils` instead. */ export interface PathUtils

extends _PathUtils

{} /** * Deprecated — TypeAlias of {@link Contrib.License.Utils.FileAttachment}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.License.Utils.FileAttachment` instead. + * @deprecated Use `Contrib.License.Utils.FileAttachment` instead. */ export interface FileAttachment

extends _FileAttachment

{} /** * Deprecated — TypeAlias of {@link Contrib.License.Utils.ErrorReporter}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.License.Utils.ErrorReporter` instead. + * @deprecated Use `Contrib.License.Utils.ErrorReporter` instead. */ export type ErrorReporter = _ErrorReporter /** * Deprecated — Alias of {@link Contrib.License.Utils.LicenseEvidenceGatherer}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.License.Utils.LicenseEvidenceGatherer` instead. + * @deprecated Use `Contrib.License.Utils.LicenseEvidenceGatherer` instead. */ export class LicenseEvidenceGatherer extends _LicenseEvidenceGatherer {} diff --git a/src/utils/npmjsUtility.node.ts b/src/utils/npmjsUtility.node.ts index 2e151f957..0b1fce4f3 100644 --- a/src/utils/npmjsUtility.node.ts +++ b/src/utils/npmjsUtility.node.ts @@ -22,15 +22,13 @@ import {defaultRegistryMatcher as _defaultRegistryMatcher, parsePackageIntegrity /** * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Utils.parsePackageIntegrity}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Utils.parsePackageIntegrity` instead. + * @deprecated Use `Contrib.FromNodePackageJson.Utils.parsePackageIntegrity` instead. */ export const parsePackageIntegrity = _parsePackageIntegrity /** * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Utils.defaultRegistryMatcher}. * - * @deprecated This re-export location is deprecated. - * Import `Contrib.FromNodePackageJson.Utils.defaultRegistryMatcher` instead. + * @deprecated Use `Contrib.FromNodePackageJson.Utils.defaultRegistryMatcher` instead. */ export const defaultRegistryMatcher = _defaultRegistryMatcher From d2b41cc3593333391a3bc6bba341341a5d682c5b Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 17:48:46 +0100 Subject: [PATCH 11/18] docs Signed-off-by: Jan Kowalleck --- HISTORY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 06c8d3f8c..88799dc24 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,9 +7,9 @@ All notable changes to this project will be documented in this file. * Fixed - * Type declarations for deprecated symbols support usage as type, again ([#1350] via [#1351]) + * Type declarations for deprecated symbols support usage types ([#1350] via [#1351]) * Refactor - * Some of the deprecated symbols in `factories` and `builders` turned from re-exports into class extensions (via [#1351]) + * Some of the deprecated symbols in `factories` and `builders` turned from re-exports from re-exports into class/interfaces/types (via [#1351]) Note: this change adds overhead for the sake of documentation. [#1350]: https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 From ad5761d7c55b92a4144f837b75c5f4bd4c0a2fb6 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 17:49:56 +0100 Subject: [PATCH 12/18] examples Signed-off-by: Jan Kowalleck --- examples/node/typescript/example.cjs/package.json | 2 +- examples/node/typescript/example.mjs/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/node/typescript/example.cjs/package.json b/examples/node/typescript/example.cjs/package.json index 098ad2c92..5531d618b 100644 --- a/examples/node/typescript/example.cjs/package.json +++ b/examples/node/typescript/example.cjs/package.json @@ -23,6 +23,6 @@ "scripts": { "prebuild": "tsc -b --clean", "build": "tsc -b", - "example": "node dist/example.js; node dist/deprecated.js; " + "example": "node dist/example.js && node dist/deprecated.js" } } diff --git a/examples/node/typescript/example.mjs/package.json b/examples/node/typescript/example.mjs/package.json index 89184abe5..6404c5d98 100644 --- a/examples/node/typescript/example.mjs/package.json +++ b/examples/node/typescript/example.mjs/package.json @@ -23,6 +23,6 @@ "scripts": { "prebuild": "tsc -b --clean", "build": "tsc -b", - "example": "node dist/example.js; node dist/deprecated.js" + "example": "node dist/example.js && node dist/deprecated.js" } } From 2ae97f4e3a2f0cf97d870b967736df733f6b1836 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 18:04:31 +0100 Subject: [PATCH 13/18] tidy Signed-off-by: Jan Kowalleck --- examples/node/javascript/deprecated.cjs | 2 +- examples/node/javascript/deprecated.mjs | 2 +- examples/node/javascript/package.json | 2 +- examples/node/typescript/example.cjs/src/deprecated.ts | 4 +--- examples/node/typescript/example.mjs/src/deprecated.ts | 4 +--- src/builders/fromNodePackageJson.node.ts | 2 +- src/factories/fromNodePackageJson.node.ts | 6 +++--- 7 files changed, 9 insertions(+), 13 deletions(-) diff --git a/examples/node/javascript/deprecated.cjs b/examples/node/javascript/deprecated.cjs index 05beecb6b..b77e44220 100644 --- a/examples/node/javascript/deprecated.cjs +++ b/examples/node/javascript/deprecated.cjs @@ -30,7 +30,7 @@ const CDX = require('@cyclonedx/cyclonedx-library') const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() -const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher +const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher.test('foo') const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') const dLU1 = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs, path}) diff --git a/examples/node/javascript/deprecated.mjs b/examples/node/javascript/deprecated.mjs index 717887f42..d49b70178 100644 --- a/examples/node/javascript/deprecated.mjs +++ b/examples/node/javascript/deprecated.mjs @@ -30,7 +30,7 @@ import * as CDX from '@cyclonedx/cyclonedx-library' const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() -const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher +const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher.test('foo') const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') const dLU1 = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs, path}) diff --git a/examples/node/javascript/package.json b/examples/node/javascript/package.json index 28458d277..36869a5e5 100644 --- a/examples/node/javascript/package.json +++ b/examples/node/javascript/package.json @@ -6,7 +6,7 @@ "node": ">=20.18.0" }, "dependencies": { - "@cyclonedx/cyclonedx-library": "../../..", + "@cyclonedx/cyclonedx-library": "file:../../..", "xmlbuilder2": "^3.0.2||^4.0.0" }, "optionalDependencies": { diff --git a/examples/node/typescript/example.cjs/src/deprecated.ts b/examples/node/typescript/example.cjs/src/deprecated.ts index e27a42ed8..9b23a74a0 100644 --- a/examples/node/typescript/example.cjs/src/deprecated.ts +++ b/examples/node/typescript/example.cjs/src/deprecated.ts @@ -28,11 +28,9 @@ import * as path from 'node:path' import * as CDX from '@cyclonedx/cyclonedx-library' // full Library is available as `CDX`, now - const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() - -const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher +const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher.test('foo') const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') type dLU1_T = CDX.Utils.LicenseUtility.LicenseEvidenceGatherer diff --git a/examples/node/typescript/example.mjs/src/deprecated.ts b/examples/node/typescript/example.mjs/src/deprecated.ts index e27a42ed8..9b23a74a0 100644 --- a/examples/node/typescript/example.mjs/src/deprecated.ts +++ b/examples/node/typescript/example.mjs/src/deprecated.ts @@ -28,11 +28,9 @@ import * as path from 'node:path' import * as CDX from '@cyclonedx/cyclonedx-library' // full Library is available as `CDX`, now - const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() - -const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher +const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher.test('foo') const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') type dLU1_T = CDX.Utils.LicenseUtility.LicenseEvidenceGatherer diff --git a/src/builders/fromNodePackageJson.node.ts b/src/builders/fromNodePackageJson.node.ts index ebf06b729..9d931195c 100644 --- a/src/builders/fromNodePackageJson.node.ts +++ b/src/builders/fromNodePackageJson.node.ts @@ -26,7 +26,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. * Normalization should be done downstream, for example via [`normalize-package-data`](https://www.npmjs.com/package/normalize-package-data). */ -import {ComponentBuilder as _ComponentBuilder,ToolBuilder as _ToolBuilder} from '../contrib/fromNodePackageJson/builders' +import {ComponentBuilder as _ComponentBuilder, ToolBuilder as _ToolBuilder} from '../contrib/fromNodePackageJson/builders' /** diff --git a/src/factories/fromNodePackageJson.node.ts b/src/factories/fromNodePackageJson.node.ts index a54cc30b0..4e3371d09 100644 --- a/src/factories/fromNodePackageJson.node.ts +++ b/src/factories/fromNodePackageJson.node.ts @@ -17,12 +17,12 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import { ExternalReferenceFactory as _ExternalReferenceFactory,PackageUrlFactory as _PackageUrlFactory } from '../contrib/fromNodePackageJson/factories' +import { ExternalReferenceFactory as _ExternalReferenceFactory, PackageUrlFactory as _PackageUrlFactory } from '../contrib/fromNodePackageJson/factories' /** - * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Factories.PackageUrlFactory}. + * Deprecated — Alias of {@link Contrib.FromNodePackageJson.Factories.ExternalReferenceFactory}. * - * @deprecated Use `Contrib.FromNodePackageJson.Factories.PackageUrlFactory` instead. + * @deprecated Use `Contrib.FromNodePackageJson.Factories.ExternalReferenceFactory` instead. */ export class ExternalReferenceFactory extends _ExternalReferenceFactory {} From ee4ff8589a3e21c7106a3f014e0326b834f0a52d Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 18:52:43 +0100 Subject: [PATCH 14/18] dings Signed-off-by: Jan Kowalleck --- examples/node/javascript/.gitignore | 1 + examples/node/javascript/deprecated.cjs | 13 ++++++++++--- examples/node/javascript/deprecated.mjs | 13 ++++++++++--- examples/node/javascript/jsconfig.json | 12 ++++++++++++ examples/node/javascript/package.json | 4 ++++ .../node/typescript/example.cjs/src/deprecated.ts | 11 +++++++++-- examples/node/typescript/example.cjs/tsconfig.json | 9 ++++----- .../node/typescript/example.mjs/src/deprecated.ts | 11 +++++++++-- examples/node/typescript/example.mjs/tsconfig.json | 8 +++----- 9 files changed, 62 insertions(+), 20 deletions(-) create mode 100644 examples/node/javascript/jsconfig.json diff --git a/examples/node/javascript/.gitignore b/examples/node/javascript/.gitignore index 0fc3a3fb8..cb76925c5 100644 --- a/examples/node/javascript/.gitignore +++ b/examples/node/javascript/.gitignore @@ -5,4 +5,5 @@ !/deprecated.cjs !/deprecated.mjs !/package.json +!/jsconfig.json !/.npmrc diff --git a/examples/node/javascript/deprecated.cjs b/examples/node/javascript/deprecated.cjs index b77e44220..865d755c7 100644 --- a/examples/node/javascript/deprecated.cjs +++ b/examples/node/javascript/deprecated.cjs @@ -29,22 +29,29 @@ const CDX = require('@cyclonedx/cyclonedx-library') // full Library is available as `CDX`, now const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() +console.log(dBU1) const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher.test('foo') const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') +console.log(dNU1, dNU2) const dLU1 = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs, path}) +console.log(dLU1) /** @type {CDX.Types.NodePackageJson} */ const dTnpj1 = {} -try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } +const dTnp2 = CDX.Types.isNodePackageJson(dTnpj1) try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } +console.log(dTnpj1, dTnp2) const dF1 = new CDX.Factories.PackageUrlFactory('generic') const dF2 = new CDX.Factories.LicenseFactory() +console.log(dF1, dF2) -const dFnpj3 = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') -const dFnpj4 = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() +const dFnpj1 = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') +const dFnpj2 = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() +console.log(dFnpj1, dFnpj2) const dBnpj1 = new CDX.Builders.FromNodePackageJson.ComponentBuilder(dFnpj4, dF2) const dBnpj2 = new CDX.Builders.FromNodePackageJson.ToolBuilder(dFnpj4) +console.log(dBnpj1, dBnpj2) diff --git a/examples/node/javascript/deprecated.mjs b/examples/node/javascript/deprecated.mjs index d49b70178..0ae48d2e1 100644 --- a/examples/node/javascript/deprecated.mjs +++ b/examples/node/javascript/deprecated.mjs @@ -29,22 +29,29 @@ import * as CDX from '@cyclonedx/cyclonedx-library' // full Library is available as `CDX`, now const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() +console.log(dBU1) const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher.test('foo') const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') +console.log(dNU1, dNU2) const dLU1 = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs, path}) +console.log(dLU1) /** @type {CDX.Types.NodePackageJson} */ const dTnpj1 = {} -try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } +const dTnp2 = CDX.Types.isNodePackageJson(dTnpj1) try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } +console.log(dTnpj1, dTnp2) const dF1 = new CDX.Factories.PackageUrlFactory('generic') const dF2 = new CDX.Factories.LicenseFactory() +console.log(dF1, dF2) -const dFnpj3 = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') -const dFnpj4 = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() +const dFnpj1 = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') +const dFnpj2 = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() +console.log(dFnpj1, dFnpj2) const dBnpj1 = new CDX.Builders.FromNodePackageJson.ComponentBuilder(dFnpj4, dF2) const dBnpj2 = new CDX.Builders.FromNodePackageJson.ToolBuilder(dFnpj4) +console.log(dBnpj1, dBnpj2) diff --git a/examples/node/javascript/jsconfig.json b/examples/node/javascript/jsconfig.json new file mode 100644 index 000000000..28b719e3f --- /dev/null +++ b/examples/node/javascript/jsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "checkJs": true, + "target": "ESNext", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "types": ["node"], + "lib": ["esnext"], + "strict": true + }, + "exclude": ["node_modules"] +} diff --git a/examples/node/javascript/package.json b/examples/node/javascript/package.json index 36869a5e5..afab53392 100644 --- a/examples/node/javascript/package.json +++ b/examples/node/javascript/package.json @@ -2,6 +2,7 @@ "private": true, "name": "@cyclonedx/cyclonedx-library-examples-node-javascript", "license": "Apache-2.0", + "type": "module", "engines": { "node": ">=20.18.0" }, @@ -14,5 +15,8 @@ "ajv-formats": "^3.0.1", "ajv-formats-draft2019": "^1.6.1", "libxmljs2": "^0.35||^0.37" + }, + "devDependencies": { + "@types/node": ">=20.18.0" } } diff --git a/examples/node/typescript/example.cjs/src/deprecated.ts b/examples/node/typescript/example.cjs/src/deprecated.ts index 9b23a74a0..7133172ab 100644 --- a/examples/node/typescript/example.cjs/src/deprecated.ts +++ b/examples/node/typescript/example.cjs/src/deprecated.ts @@ -29,30 +29,37 @@ import * as CDX from '@cyclonedx/cyclonedx-library' // full Library is available as `CDX`, now const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() +console.log(dBU1) const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher.test('foo') const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') +console.log(dNU1, dNU2) type dLU1_T = CDX.Utils.LicenseUtility.LicenseEvidenceGatherer const fsU: CDX.Utils.LicenseUtility.FsUtils = fs const pathU: CDX.Utils.LicenseUtility.PathUtils = path -const dLU1 = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs: fsU, path: pathU}) +const dLU1: dLU1_T = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs: fsU, path: pathU}) +console.log(fsU, pathU, dLU1) const dTnpj1: CDX.Types.NodePackageJson = {} -try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } +const dTnpj2 =CDX.Types.isNodePackageJson(dTnpj1) try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } +console.log(dTnpj1, dTnpj2) type dF1_T = CDX.Factories.PackageUrlFactory type dF2_T = CDX.Factories.LicenseFactory const dF1: dF1_T = new CDX.Factories.PackageUrlFactory('generic') const dF2: dF2_T = new CDX.Factories.LicenseFactory() +console.log(dF1, dF2) type dFnpj3_T = CDX.Factories.FromNodePackageJson.PackageUrlFactory const dFnpj3: dFnpj3_T = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') type dFnpj4_T = CDX.Factories.FromNodePackageJson.ExternalReferenceFactory const dFnpj4: dFnpj4_T = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() +console.log(dFnpj3, dFnpj4) type dBnpj1_T = CDX.Builders.FromNodePackageJson.ComponentBuilder const dBnpj1: dBnpj1_T = new CDX.Builders.FromNodePackageJson.ComponentBuilder(dFnpj4, dF2) type dBnpj2_T = CDX.Builders.FromNodePackageJson.ToolBuilder const dBnpj2: dBnpj2_T = new CDX.Builders.FromNodePackageJson.ToolBuilder(dFnpj4) +console.log(dBnpj1, dBnpj2) diff --git a/examples/node/typescript/example.cjs/tsconfig.json b/examples/node/typescript/example.cjs/tsconfig.json index 752f534ae..8ada4374c 100644 --- a/examples/node/typescript/example.cjs/tsconfig.json +++ b/examples/node/typescript/example.cjs/tsconfig.json @@ -3,14 +3,13 @@ "compilerOptions": { "target": "ES2016", "module": "CommonJS", + "moduleResolution": "node", + "types": ["node"], + "lib": ["esnext"], "outDir": "./dist", "strict": true, "forceConsistentCasingInFileNames": true, "disableSourceOfProjectReferenceRedirect": false, "rootDir": "src" - }, - "files": [ - "./src/example.ts", - "./src/deprecated.ts" - ] + } } diff --git a/examples/node/typescript/example.mjs/src/deprecated.ts b/examples/node/typescript/example.mjs/src/deprecated.ts index 9b23a74a0..7133172ab 100644 --- a/examples/node/typescript/example.mjs/src/deprecated.ts +++ b/examples/node/typescript/example.mjs/src/deprecated.ts @@ -29,30 +29,37 @@ import * as CDX from '@cyclonedx/cyclonedx-library' // full Library is available as `CDX`, now const dBU1 = CDX.Utils.BomUtility.randomSerialNumber() +console.log(dBU1) const dNU1 = CDX.Utils.NpmjsUtility.defaultRegistryMatcher.test('foo') const dNU2 = CDX.Utils.NpmjsUtility.parsePackageIntegrity('sha1-aSbRsZT7xze47tUTdW3i/Np+pAg=') +console.log(dNU1, dNU2) type dLU1_T = CDX.Utils.LicenseUtility.LicenseEvidenceGatherer const fsU: CDX.Utils.LicenseUtility.FsUtils = fs const pathU: CDX.Utils.LicenseUtility.PathUtils = path -const dLU1 = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs: fsU, path: pathU}) +const dLU1: dLU1_T = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs: fsU, path: pathU}) +console.log(fsU, pathU, dLU1) const dTnpj1: CDX.Types.NodePackageJson = {} -try { CDX.Types.isNodePackageJson(dTnpj1) } catch { /* not implemented */ } +const dTnpj2 =CDX.Types.isNodePackageJson(dTnpj1) try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } +console.log(dTnpj1, dTnpj2) type dF1_T = CDX.Factories.PackageUrlFactory type dF2_T = CDX.Factories.LicenseFactory const dF1: dF1_T = new CDX.Factories.PackageUrlFactory('generic') const dF2: dF2_T = new CDX.Factories.LicenseFactory() +console.log(dF1, dF2) type dFnpj3_T = CDX.Factories.FromNodePackageJson.PackageUrlFactory const dFnpj3: dFnpj3_T = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') type dFnpj4_T = CDX.Factories.FromNodePackageJson.ExternalReferenceFactory const dFnpj4: dFnpj4_T = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() +console.log(dFnpj3, dFnpj4) type dBnpj1_T = CDX.Builders.FromNodePackageJson.ComponentBuilder const dBnpj1: dBnpj1_T = new CDX.Builders.FromNodePackageJson.ComponentBuilder(dFnpj4, dF2) type dBnpj2_T = CDX.Builders.FromNodePackageJson.ToolBuilder const dBnpj2: dBnpj2_T = new CDX.Builders.FromNodePackageJson.ToolBuilder(dFnpj4) +console.log(dBnpj1, dBnpj2) diff --git a/examples/node/typescript/example.mjs/tsconfig.json b/examples/node/typescript/example.mjs/tsconfig.json index 07139a702..03141320c 100644 --- a/examples/node/typescript/example.mjs/tsconfig.json +++ b/examples/node/typescript/example.mjs/tsconfig.json @@ -3,14 +3,12 @@ "compilerOptions": { "target": "ES2021", "module": "Node16", + "types": ["node"], + "lib": ["esnext"], "outDir": "./dist", "strict": true, "forceConsistentCasingInFileNames": true, "disableSourceOfProjectReferenceRedirect": false, "rootDir": "src" - }, - "files": [ - "./src/example.ts", - "./src/deprecated.ts" - ] + } } From e193f1a112e071b1991c20526b9c4ef2401e702b Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 19:06:43 +0100 Subject: [PATCH 15/18] dings Signed-off-by: Jan Kowalleck --- examples/node/javascript/deprecated.cjs | 10 +++++----- examples/node/javascript/deprecated.mjs | 10 +++++----- examples/node/typescript/example.cjs/src/deprecated.ts | 6 +++--- examples/node/typescript/example.cjs/tsconfig.json | 1 + examples/node/typescript/example.mjs/src/deprecated.ts | 6 +++--- examples/node/typescript/example.mjs/tsconfig.json | 1 + 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/examples/node/javascript/deprecated.cjs b/examples/node/javascript/deprecated.cjs index 865d755c7..c9523545e 100644 --- a/examples/node/javascript/deprecated.cjs +++ b/examples/node/javascript/deprecated.cjs @@ -40,17 +40,17 @@ console.log(dLU1) /** @type {CDX.Types.NodePackageJson} */ const dTnpj1 = {} -const dTnp2 = CDX.Types.isNodePackageJson(dTnpj1) +// const dTnpj2 =CDX.Types.isNodePackageJson(dTnpj1) try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } -console.log(dTnpj1, dTnp2) +console.log(dTnpj1) const dF1 = new CDX.Factories.PackageUrlFactory('generic') const dF2 = new CDX.Factories.LicenseFactory() console.log(dF1, dF2) -const dFnpj1 = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') -const dFnpj2 = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() -console.log(dFnpj1, dFnpj2) +const dFnpj3 = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') +const dFnpj4 = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() +console.log(dFnpj3, dFnpj4) const dBnpj1 = new CDX.Builders.FromNodePackageJson.ComponentBuilder(dFnpj4, dF2) const dBnpj2 = new CDX.Builders.FromNodePackageJson.ToolBuilder(dFnpj4) diff --git a/examples/node/javascript/deprecated.mjs b/examples/node/javascript/deprecated.mjs index 0ae48d2e1..6dce55e72 100644 --- a/examples/node/javascript/deprecated.mjs +++ b/examples/node/javascript/deprecated.mjs @@ -40,17 +40,17 @@ console.log(dLU1) /** @type {CDX.Types.NodePackageJson} */ const dTnpj1 = {} -const dTnp2 = CDX.Types.isNodePackageJson(dTnpj1) +// const dTnpj2 =CDX.Types.isNodePackageJson(dTnpj1) try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } -console.log(dTnpj1, dTnp2) +console.log(dTnpj1) const dF1 = new CDX.Factories.PackageUrlFactory('generic') const dF2 = new CDX.Factories.LicenseFactory() console.log(dF1, dF2) -const dFnpj1 = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') -const dFnpj2 = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() -console.log(dFnpj1, dFnpj2) +const dFnpj3 = new CDX.Factories.FromNodePackageJson.PackageUrlFactory('npm') +const dFnpj4 = new CDX.Factories.FromNodePackageJson.ExternalReferenceFactory() +console.log(dFnpj3, dFnpj4) const dBnpj1 = new CDX.Builders.FromNodePackageJson.ComponentBuilder(dFnpj4, dF2) const dBnpj2 = new CDX.Builders.FromNodePackageJson.ToolBuilder(dFnpj4) diff --git a/examples/node/typescript/example.cjs/src/deprecated.ts b/examples/node/typescript/example.cjs/src/deprecated.ts index 7133172ab..9dc930bd6 100644 --- a/examples/node/typescript/example.cjs/src/deprecated.ts +++ b/examples/node/typescript/example.cjs/src/deprecated.ts @@ -39,12 +39,12 @@ type dLU1_T = CDX.Utils.LicenseUtility.LicenseEvidenceGatherer const fsU: CDX.Utils.LicenseUtility.FsUtils = fs const pathU: CDX.Utils.LicenseUtility.PathUtils = path const dLU1: dLU1_T = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs: fsU, path: pathU}) -console.log(fsU, pathU, dLU1) +console.log(dLU1) const dTnpj1: CDX.Types.NodePackageJson = {} -const dTnpj2 =CDX.Types.isNodePackageJson(dTnpj1) +// const dTnpj2 =CDX.Types.isNodePackageJson(dTnpj1) try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } -console.log(dTnpj1, dTnpj2) +console.log(dTnpj1) type dF1_T = CDX.Factories.PackageUrlFactory type dF2_T = CDX.Factories.LicenseFactory diff --git a/examples/node/typescript/example.cjs/tsconfig.json b/examples/node/typescript/example.cjs/tsconfig.json index 8ada4374c..e459a37b0 100644 --- a/examples/node/typescript/example.cjs/tsconfig.json +++ b/examples/node/typescript/example.cjs/tsconfig.json @@ -6,6 +6,7 @@ "moduleResolution": "node", "types": ["node"], "lib": ["esnext"], + "sourceMap": true, "outDir": "./dist", "strict": true, "forceConsistentCasingInFileNames": true, diff --git a/examples/node/typescript/example.mjs/src/deprecated.ts b/examples/node/typescript/example.mjs/src/deprecated.ts index 7133172ab..9dc930bd6 100644 --- a/examples/node/typescript/example.mjs/src/deprecated.ts +++ b/examples/node/typescript/example.mjs/src/deprecated.ts @@ -39,12 +39,12 @@ type dLU1_T = CDX.Utils.LicenseUtility.LicenseEvidenceGatherer const fsU: CDX.Utils.LicenseUtility.FsUtils = fs const pathU: CDX.Utils.LicenseUtility.PathUtils = path const dLU1: dLU1_T = new CDX.Utils.LicenseUtility.LicenseEvidenceGatherer({fs: fsU, path: pathU}) -console.log(fsU, pathU, dLU1) +console.log(dLU1) const dTnpj1: CDX.Types.NodePackageJson = {} -const dTnpj2 =CDX.Types.isNodePackageJson(dTnpj1) +// const dTnpj2 =CDX.Types.isNodePackageJson(dTnpj1) try { CDX.Types.assertNodePackageJson(dTnpj1) } catch { /* pass */ } -console.log(dTnpj1, dTnpj2) +console.log(dTnpj1) type dF1_T = CDX.Factories.PackageUrlFactory type dF2_T = CDX.Factories.LicenseFactory diff --git a/examples/node/typescript/example.mjs/tsconfig.json b/examples/node/typescript/example.mjs/tsconfig.json index 03141320c..e528ad96c 100644 --- a/examples/node/typescript/example.mjs/tsconfig.json +++ b/examples/node/typescript/example.mjs/tsconfig.json @@ -5,6 +5,7 @@ "module": "Node16", "types": ["node"], "lib": ["esnext"], + "sourceMap": true, "outDir": "./dist", "strict": true, "forceConsistentCasingInFileNames": true, From d495475ee763582ddd936b9c13da4c69850ca6e0 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 19:10:04 +0100 Subject: [PATCH 16/18] dings Signed-off-by: Jan Kowalleck --- HISTORY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 88799dc24..340bd1d59 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,7 +7,7 @@ All notable changes to this project will be documented in this file. * Fixed - * Type declarations for deprecated symbols support usage types ([#1350] via [#1351]) + * Type declarations for deprecated symbols support usage as types ([#1350] via [#1351]) * Refactor * Some of the deprecated symbols in `factories` and `builders` turned from re-exports from re-exports into class/interfaces/types (via [#1351]) Note: this change adds overhead for the sake of documentation. From d916383963c9c6a4c80e27dbf71cf101bbbd9f9b Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 19:11:03 +0100 Subject: [PATCH 17/18] docs Signed-off-by: Jan Kowalleck --- HISTORY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 340bd1d59..d3235cd3b 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,8 +9,8 @@ All notable changes to this project will be documented in this file. * Fixed * Type declarations for deprecated symbols support usage as types ([#1350] via [#1351]) * Refactor - * Some of the deprecated symbols in `factories` and `builders` turned from re-exports from re-exports into class/interfaces/types (via [#1351]) - Note: this change adds overhead for the sake of documentation. + * Deprecated symbols turned from re-exports into re-declares (via [#1351]) + Note: this change adds runtime overhead for the sake of documentation. [#1350]: https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1350 [#1351]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1351 From aa82910187dfb6213928caaa33be228963a5a4e7 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 4 Dec 2025 19:21:30 +0100 Subject: [PATCH 18/18] ci Signed-off-by: Jan Kowalleck --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 5f65fe9cd..35aaadf10 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -352,7 +352,7 @@ jobs: - name: run example run: node -- 'example.${{ matrix.js-type }}' working-directory: ${{ env.EXAMPLE_DIR }} - - name: run example + - name: run deprecated run: node -- 'deprecated.${{ matrix.js-type }}' working-directory: ${{ env.EXAMPLE_DIR }}