From 6e9c6e054740b3083bed44753425569286c39291 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Tue, 3 Nov 2026 13:03:32 +0100 Subject: [PATCH 1/7] feat: Publish sub-namespace `OptionalFeature` Signed-off-by: Jan Kowalleck --- HISTORY.md | 5 +++++ package.json | 4 ++++ src/_optPlug.node/cannot.ts | 2 +- src/index.common.ts | 1 + src/{_opt.ts => optionalFeature.ts} | 2 +- src/serialize/jsonSerializer.ts | 2 +- src/serialize/xmlSerializer.node.ts | 2 +- src/serialize/xmlSerializer.web.ts | 2 +- src/validation/jsonValidator.node.ts | 2 +- src/validation/xmlValidator.node.ts | 2 +- 10 files changed, 17 insertions(+), 7 deletions(-) rename src/{_opt.ts => optionalFeature.ts} (97%) diff --git a/HISTORY.md b/HISTORY.md index 416719dc4..388016e62 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,11 @@ All notable changes to this project will be documented in this file. +* Added + * Publish sub-namespace `OptionalFeature` (via [#]) + +[#]: + ## 10.4.0 -- 2026-11-03 * Added diff --git a/package.json b/package.json index aa17026c5..06af5b29a 100644 --- a/package.json +++ b/package.json @@ -163,6 +163,10 @@ "default": "./dist.node/index.node.js" }, "./package.json": "./package.json", + "./OptionalFeature": { + "types": "./dist.d/optionalFeature.d.ts", + "default": "./dist.node/optionalFeature.js" + }, "./Enums": { "types": "./dist.d/enums/index.d.ts", "default": "./dist.node/enums/index.js" diff --git a/src/_optPlug.node/cannot.ts b/src/_optPlug.node/cannot.ts index 04251ded4..73b74b9ba 100644 --- a/src/_optPlug.node/cannot.ts +++ b/src/_optPlug.node/cannot.ts @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import type { Cannot } from '../_opt' +import type { Cannot } from '../optionalFeature' import { isWillThrow } from './_wrapper' /** diff --git a/src/index.common.ts b/src/index.common.ts index 4fc31c771..2817b7816 100644 --- a/src/index.common.ts +++ b/src/index.common.ts @@ -22,5 +22,6 @@ export * as Models from './models' export * as SPDX from './spdx' export * as Spec from './spec' export * as Types from './types' +export * as OptionalFeature from './optionalFeature' // do not export the _helpers, they are for internal use only diff --git a/src/_opt.ts b/src/optionalFeature.ts similarity index 97% rename from src/_opt.ts rename to src/optionalFeature.ts index 84957f1bd..9372469ff 100644 --- a/src/_opt.ts +++ b/src/optionalFeature.ts @@ -20,7 +20,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. /** * Describes why an optional feature cannot act. */ -interface Blocker { +export interface Blocker { readonly message: string } diff --git a/src/serialize/jsonSerializer.ts b/src/serialize/jsonSerializer.ts index 27389fe66..d598e5c8e 100644 --- a/src/serialize/jsonSerializer.ts +++ b/src/serialize/jsonSerializer.ts @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import type * as OptionalFeature from '../_opt' +import type * as OptionalFeature from '../optionalFeature' import type { Bom } from '../models/bom' import { Format } from '../spec/enums' import { UnsupportedFormatError } from '../spec/errors' diff --git a/src/serialize/xmlSerializer.node.ts b/src/serialize/xmlSerializer.node.ts index 11bf46a0d..309f6992f 100644 --- a/src/serialize/xmlSerializer.node.ts +++ b/src/serialize/xmlSerializer.node.ts @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import type * as OptionalFeature from '../_opt' +import type * as OptionalFeature from '../optionalFeature' import cannotOf from '../_optPlug.node/cannot' import stringify from '../_optPlug.node/xmlStringify' import { MissingOptionalDependencyError } from './errors' diff --git a/src/serialize/xmlSerializer.web.ts b/src/serialize/xmlSerializer.web.ts index b0f16bccf..89e79d33b 100644 --- a/src/serialize/xmlSerializer.web.ts +++ b/src/serialize/xmlSerializer.web.ts @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ import { isNotUndefined } from '../_helpers/notUndefined' -import type * as OptionalFeature from '../_opt' +import type * as OptionalFeature from '../optionalFeature' import type { SerializerOptions } from './types' import type { SimpleXml } from './xml/types' import { XmlBaseSerializer } from './xmlBaseSerializer' diff --git a/src/validation/jsonValidator.node.ts b/src/validation/jsonValidator.node.ts index 157c585d5..21865f8ec 100644 --- a/src/validation/jsonValidator.node.ts +++ b/src/validation/jsonValidator.node.ts @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import type * as OptionalFeature from '../_opt' +import type * as OptionalFeature from '../optionalFeature' import cannotOf from '../_optPlug.node/cannot' import makeValidator, { type Validator } from '../_optPlug.node/jsonValidator' import { FILES } from '../resources.node' diff --git a/src/validation/xmlValidator.node.ts b/src/validation/xmlValidator.node.ts index 9de2ef314..8e4118a89 100644 --- a/src/validation/xmlValidator.node.ts +++ b/src/validation/xmlValidator.node.ts @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import type * as OptionalFeature from '../_opt' +import type * as OptionalFeature from '../optionalFeature' import cannotOf from '../_optPlug.node/cannot' import makeValidator, { type Validator } from '../_optPlug.node/xmlValidator' import { FILES } from '../resources.node' From 85d202a127d70cff508bfdb0147380ec7167599f Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Tue, 3 Nov 2026 13:04:24 +0100 Subject: [PATCH 2/7] 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 388016e62..1393a3a6a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,9 +7,9 @@ All notable changes to this project will be documented in this file. * Added - * Publish sub-namespace `OptionalFeature` (via [#]) + * Publish sub-namespace `OptionalFeature` (via [#1535]) -[#]: +[#1535]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1535 ## 10.4.0 -- 2026-11-03 From 1edea9d1365cfcb355cca17bbc971abaa1b5b8a3 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Tue, 3 Nov 2026 13:45:57 +0100 Subject: [PATCH 3/7] isort Signed-off-by: Jan Kowalleck --- src/index.common.ts | 2 +- src/serialize/jsonSerializer.ts | 2 +- src/serialize/xmlSerializer.node.ts | 2 +- src/validation/jsonValidator.node.ts | 2 +- src/validation/xmlValidator.node.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.common.ts b/src/index.common.ts index 2817b7816..20b43dda6 100644 --- a/src/index.common.ts +++ b/src/index.common.ts @@ -19,9 +19,9 @@ Copyright (c) OWASP Foundation. All Rights Reserved. export * as Enums from './enums' export * as Models from './models' +export type * as OptionalFeature from './optionalFeature' export * as SPDX from './spdx' export * as Spec from './spec' export * as Types from './types' -export * as OptionalFeature from './optionalFeature' // do not export the _helpers, they are for internal use only diff --git a/src/serialize/jsonSerializer.ts b/src/serialize/jsonSerializer.ts index d598e5c8e..7f124dab8 100644 --- a/src/serialize/jsonSerializer.ts +++ b/src/serialize/jsonSerializer.ts @@ -17,8 +17,8 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import type * as OptionalFeature from '../optionalFeature' import type { Bom } from '../models/bom' +import type * as OptionalFeature from '../optionalFeature' import { Format } from '../spec/enums' import { UnsupportedFormatError } from '../spec/errors' import { BaseSerializer } from './baseSerializer' diff --git a/src/serialize/xmlSerializer.node.ts b/src/serialize/xmlSerializer.node.ts index 309f6992f..ba096003c 100644 --- a/src/serialize/xmlSerializer.node.ts +++ b/src/serialize/xmlSerializer.node.ts @@ -17,9 +17,9 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import type * as OptionalFeature from '../optionalFeature' import cannotOf from '../_optPlug.node/cannot' import stringify from '../_optPlug.node/xmlStringify' +import type * as OptionalFeature from '../optionalFeature' import { MissingOptionalDependencyError } from './errors' import type { SerializerOptions } from './types' import type { SimpleXml } from './xml/types' diff --git a/src/validation/jsonValidator.node.ts b/src/validation/jsonValidator.node.ts index 21865f8ec..c4e99d6f1 100644 --- a/src/validation/jsonValidator.node.ts +++ b/src/validation/jsonValidator.node.ts @@ -17,9 +17,9 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import type * as OptionalFeature from '../optionalFeature' import cannotOf from '../_optPlug.node/cannot' import makeValidator, { type Validator } from '../_optPlug.node/jsonValidator' +import type * as OptionalFeature from '../optionalFeature' import { FILES } from '../resources.node' import { BaseValidator } from './baseValidator' import { MissingOptionalDependencyError, NotImplementedError } from './errors' diff --git a/src/validation/xmlValidator.node.ts b/src/validation/xmlValidator.node.ts index 8e4118a89..e9c2b715e 100644 --- a/src/validation/xmlValidator.node.ts +++ b/src/validation/xmlValidator.node.ts @@ -17,9 +17,9 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ -import type * as OptionalFeature from '../optionalFeature' import cannotOf from '../_optPlug.node/cannot' import makeValidator, { type Validator } from '../_optPlug.node/xmlValidator' +import type * as OptionalFeature from '../optionalFeature' import { FILES } from '../resources.node' import { BaseValidator } from './baseValidator' import { MissingOptionalDependencyError, NotImplementedError } from './errors' From f2437b3b0f8503a914d4f1bb210132217131eb08 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Tue, 3 Nov 2026 13:54:12 +0100 Subject: [PATCH 4/7] wip Signed-off-by: Jan Kowalleck --- HISTORY.md | 2 +- package.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 1393a3a6a..6b6c86fc8 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,7 +7,7 @@ All notable changes to this project will be documented in this file. * Added - * Publish sub-namespace `OptionalFeature` (via [#1535]) + * Publish sub-namespace types `OptionalFeature` (via [#1535]) [#1535]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1535 diff --git a/package.json b/package.json index 06af5b29a..f8dbbe765 100644 --- a/package.json +++ b/package.json @@ -164,8 +164,7 @@ }, "./package.json": "./package.json", "./OptionalFeature": { - "types": "./dist.d/optionalFeature.d.ts", - "default": "./dist.node/optionalFeature.js" + "types": "./dist.d/optionalFeature.d.ts" }, "./Enums": { "types": "./dist.d/enums/index.d.ts", From be23f5477a83d32725f20487fbc6936c8a5b82c6 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 9 Nov 2026 12:59:17 +0100 Subject: [PATCH 5/7] wip Signed-off-by: Jan Kowalleck --- src/index.common.ts | 4 +++- tests/functional/packageManifestExports.node.spec.js | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/index.common.ts b/src/index.common.ts index 20b43dda6..2020bdd50 100644 --- a/src/index.common.ts +++ b/src/index.common.ts @@ -19,9 +19,11 @@ Copyright (c) OWASP Foundation. All Rights Reserved. export * as Enums from './enums' export * as Models from './models' -export type * as OptionalFeature from './optionalFeature' export * as SPDX from './spdx' export * as Spec from './spec' export * as Types from './types' +import type * as OptionalFeature from './optionalFeature' +export type {OptionalFeature} + // do not export the _helpers, they are for internal use only diff --git a/tests/functional/packageManifestExports.node.spec.js b/tests/functional/packageManifestExports.node.spec.js index 34deefcd5..098ed5266 100644 --- a/tests/functional/packageManifestExports.node.spec.js +++ b/tests/functional/packageManifestExports.node.spec.js @@ -33,6 +33,13 @@ suite('functional: packageManifest:exports', () => { /** @type {Set} */ const pjRelExported = new Set( Object.keys(pjExports) + .filter(e => { + const ed = pjExports[e] + const edT = typeof ed + if (edT === 'string') return true + if (edT !== 'object') throw new RangeError(`unexpected export definition type for ${e}`) + return Object.hasOwn(ed, 'node') || Object.hasOwn(ed, 'default') + }) .filter(e => e.startsWith('./')) .map(e => e.substring(2)) ) @@ -61,7 +68,7 @@ suite('functional: packageManifest:exports', () => { } }) - suite('does not export internal sobmodules', () => { + suite('does not export internal submodules', () => { for (const [cdxModName, cdxMod] of Object.entries(CDX)) { if (!cdxModName.startsWith('_')) { continue // skip non-internal From e6789df424b65aa0280a08235b6ffab15a3e42eb Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 9 Nov 2026 13:00:16 +0100 Subject: [PATCH 6/7] wip Signed-off-by: Jan Kowalleck --- src/index.common.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.common.ts b/src/index.common.ts index 2020bdd50..91bbc3444 100644 --- a/src/index.common.ts +++ b/src/index.common.ts @@ -17,13 +17,13 @@ SPDX-License-Identifier: Apache-2.0 Copyright (c) OWASP Foundation. All Rights Reserved. */ +import type * as OptionalFeature from './optionalFeature' + export * as Enums from './enums' export * as Models from './models' export * as SPDX from './spdx' export * as Spec from './spec' export * as Types from './types' - -import type * as OptionalFeature from './optionalFeature' export type {OptionalFeature} // do not export the _helpers, they are for internal use only From f3318773d88093f934324b39c7eaad98f48f15a3 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 9 Nov 2026 13:02:35 +0100 Subject: [PATCH 7/7] wip Signed-off-by: Jan Kowalleck --- src/index.common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.common.ts b/src/index.common.ts index 91bbc3444..6117218bb 100644 --- a/src/index.common.ts +++ b/src/index.common.ts @@ -24,6 +24,6 @@ export * as Models from './models' export * as SPDX from './spdx' export * as Spec from './spec' export * as Types from './types' -export type {OptionalFeature} +export type { OptionalFeature } // do not export the _helpers, they are for internal use only