From e65167f06bdd45e57160da4fce2465747447df0c Mon Sep 17 00:00:00 2001 From: Rafael Mestre <277805+rlmestre@users.noreply.github.com> Date: Tue, 5 Aug 2025 08:48:49 -0400 Subject: [PATCH] fix: drop module suffixes (.mts) for compatibility --- README.md | 6 +++--- package.json | 10 +++++----- src/bom/{validation.mts => validation.ts} | 2 +- ...-to-json.test.mts => cdx-xml-to-json.test.ts} | 2 +- src/{cdx-xml-to-json.mts => cdx-xml-to-json.ts} | 2 +- src/eol/{utils.test.mts => utils.test.ts} | 4 ++-- src/eol/{utils.mts => utils.ts} | 4 ++-- src/{index.mts => index.ts} | 16 ++++++++-------- ...{spdx-to-cdx.test.mts => spdx-to-cdx.test.ts} | 4 ++-- src/{spdx-to-cdx.mts => spdx-to-cdx.ts} | 0 ...rim-cdx-bom.test.mts => trim-cdx-bom.test.ts} | 4 ++-- src/{trim-cdx-bom.mts => trim-cdx-bom.ts} | 2 +- src/types/{eol-scan.mts => eol-scan.ts} | 2 +- src/types/{index.mts => index.ts} | 0 14 files changed, 29 insertions(+), 29 deletions(-) rename src/bom/{validation.mts => validation.ts} (93%) rename src/{cdx-xml-to-json.test.mts => cdx-xml-to-json.test.ts} (97%) rename src/{cdx-xml-to-json.mts => cdx-xml-to-json.ts} (99%) rename src/eol/{utils.test.mts => utils.test.ts} (97%) rename src/eol/{utils.mts => utils.ts} (94%) rename src/{index.mts => index.ts} (61%) rename src/{spdx-to-cdx.test.mts => spdx-to-cdx.test.ts} (99%) rename src/{spdx-to-cdx.mts => spdx-to-cdx.ts} (100%) rename src/{trim-cdx-bom.test.mts => trim-cdx-bom.test.ts} (95%) rename src/{trim-cdx-bom.mts => trim-cdx-bom.ts} (92%) rename src/types/{eol-scan.mts => eol-scan.ts} (96%) rename src/types/{index.mts => index.ts} (100%) diff --git a/README.md b/README.md index c9c8851..ec5b709 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ npm install github:herodevs/eol-shared ## API -### [`spdxToCdxBom(spdxBom: SPDX23): CdxBom`](./src/spdx-to-cdx.mts#L61) +### [`spdxToCdxBom(spdxBom: SPDX23): CdxBom`](./src/spdx-to-cdx.ts#L61) Converts an SPDX BOM to CycloneDX format. This conversion takes the most important package and relationship data from SPDX and translates them into CycloneDX components and dependencies as closely as possible. @@ -31,7 +31,7 @@ const cdxBom: CdxBom = spdxToCdxBom(spdxBom); **Parameters**: `spdxBom` - The SPDX BOM object to convert **Returns**: A CycloneDX BOM object -### [`xmlStringToJSON(xmlString: string): CdxBom`](./src/cdx-xml-to-json.mts#L161) +### [`xmlStringToJSON(xmlString: string): CdxBom`](./src/cdx-xml-to-json.ts#L161) Converts a CycloneDX XML string to a JSON object. The CycloneDX spec does not change between formats, so conversion from XML to JSON is lossless. @@ -46,7 +46,7 @@ const jsonBom: CdxBom = xmlStringToJSON(xmlString); **Parameters**: `xmlString` - The XML string to parse **Returns**: The parsed CycloneDX BOM object -### [`trimCdxBom(cdxBom: CdxBom): CdxBom`](./src/trim-cdx-bom.mts#L3) +### [`trimCdxBom(cdxBom: CdxBom): CdxBom`](./src/trim-cdx-bom.ts#L3) Creates a trimmed copy of a CycloneDX BOM by removing SBOM data not necessary for EOL scanning: diff --git a/package.json b/package.json index 9c08b86..6478c56 100644 --- a/package.json +++ b/package.json @@ -15,13 +15,13 @@ ], "exports": { ".": { - "import": "./dist/index.mjs", - "require": "./dist/index.mjs", - "types": "./dist/index.d.mts" + "import": "./dist/index.js", + "require": "./dist/index.js", + "types": "./dist/index.d.ts" } }, - "main": "./dist/index.mjs", - "types": "./dist/index.d.mts", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/herodevs/eol-shared.git" diff --git a/src/bom/validation.mts b/src/bom/validation.ts similarity index 93% rename from src/bom/validation.mts rename to src/bom/validation.ts index 9680914..837575f 100644 --- a/src/bom/validation.mts +++ b/src/bom/validation.ts @@ -1,5 +1,5 @@ import type { SPDX23 } from '../types/bom/spdx-2.3.schema.ts'; -import type { CdxBom, SupportedBom } from '../types/index.mjs'; +import type { CdxBom, SupportedBom } from '../types/index.js'; function parseBomOrString(bomOrString: string | object): SupportedBom | null { if (typeof bomOrString === 'string') { diff --git a/src/cdx-xml-to-json.test.mts b/src/cdx-xml-to-json.test.ts similarity index 97% rename from src/cdx-xml-to-json.test.mts rename to src/cdx-xml-to-json.test.ts index 914b04b..9fbab24 100644 --- a/src/cdx-xml-to-json.test.mts +++ b/src/cdx-xml-to-json.test.ts @@ -1,7 +1,7 @@ import { test, describe } from 'node:test'; import { strict as assert } from 'node:assert'; import { readFile } from 'node:fs/promises'; -import { xmlStringToJSON } from './cdx-xml-to-json.mts'; +import { xmlStringToJSON } from './cdx-xml-to-json.ts'; describe('CycloneDX XML to JSON Converter', () => { test('should convert CycloneDX 1.4 XML to JSON with correct structure', async () => { diff --git a/src/cdx-xml-to-json.mts b/src/cdx-xml-to-json.ts similarity index 99% rename from src/cdx-xml-to-json.mts rename to src/cdx-xml-to-json.ts index 6dc5193..f0e8471 100644 --- a/src/cdx-xml-to-json.mts +++ b/src/cdx-xml-to-json.ts @@ -1,5 +1,5 @@ import { XMLParser } from 'fast-xml-parser'; -import type { CdxBom } from './index.mts'; +import type { CdxBom } from './index.ts'; const COLLECTION_KEYS = [ 'tools', diff --git a/src/eol/utils.test.mts b/src/eol/utils.test.ts similarity index 97% rename from src/eol/utils.test.mts rename to src/eol/utils.test.ts index ade248d..cdb3cb5 100644 --- a/src/eol/utils.test.mts +++ b/src/eol/utils.test.ts @@ -1,7 +1,7 @@ import { test, describe } from 'node:test'; import { strict as assert } from 'node:assert'; -import { deriveComponentStatus } from './utils.mts'; -import type { EolScanComponentMetadata } from '../types/eol-scan.mts'; +import { deriveComponentStatus } from './utils.ts'; +import type { EolScanComponentMetadata } from '../types/eol-scan.ts'; describe('deriveComponentStatus', () => { test('should return UNKNOWN when there is no metadata', () => { diff --git a/src/eol/utils.mts b/src/eol/utils.ts similarity index 94% rename from src/eol/utils.mts rename to src/eol/utils.ts index 71281c2..d16f43e 100644 --- a/src/eol/utils.mts +++ b/src/eol/utils.ts @@ -1,9 +1,9 @@ import { PackageURL } from 'packageurl-js'; -import type { CdxBom } from '../types/index.mjs'; +import type { CdxBom } from '../types/index.js'; import type { ComponentStatus, EolScanComponentMetadata, -} from '../types/eol-scan.mjs'; +} from '../types/eol-scan.js'; export function deriveComponentStatus( metadata: EolScanComponentMetadata | null, diff --git a/src/index.mts b/src/index.ts similarity index 61% rename from src/index.mts rename to src/index.ts index 515dd0f..63ef028 100644 --- a/src/index.mts +++ b/src/index.ts @@ -1,7 +1,7 @@ -export { xmlStringToJSON } from './cdx-xml-to-json.mjs'; -export { trimCdxBom } from './trim-cdx-bom.mjs'; -export { spdxToCdxBom } from './spdx-to-cdx.mjs'; -export { deriveComponentStatus, extractPurlsFromCdxBom } from './eol/utils.mjs'; +export { xmlStringToJSON } from './cdx-xml-to-json.js'; +export { trimCdxBom } from './trim-cdx-bom.js'; +export { spdxToCdxBom } from './spdx-to-cdx.js'; +export { deriveComponentStatus, extractPurlsFromCdxBom } from './eol/utils.js'; export type { ComponentStatus, @@ -14,7 +14,7 @@ export type { EolReportQueryResponse, EolReportMutationResponse, NesRemediation, -} from './types/eol-scan.mjs'; +} from './types/eol-scan.js'; export type { CdxBom, @@ -25,7 +25,7 @@ export type { License, SPDX23, SupportedBom, -} from './types/index.mjs'; +} from './types/index.js'; -export { ComponentScope } from './types/index.mjs'; -export { isCdxBom, isSpdxBom, isSupportedBom } from './bom/validation.mjs'; +export { ComponentScope } from './types/index.js'; +export { isCdxBom, isSpdxBom, isSupportedBom } from './bom/validation.js'; diff --git a/src/spdx-to-cdx.test.mts b/src/spdx-to-cdx.test.ts similarity index 99% rename from src/spdx-to-cdx.test.mts rename to src/spdx-to-cdx.test.ts index e3c91b7..ba27024 100644 --- a/src/spdx-to-cdx.test.mts +++ b/src/spdx-to-cdx.test.ts @@ -1,8 +1,8 @@ import { test, describe } from 'node:test'; import { strict as assert } from 'node:assert'; -import { spdxToCdxBom } from './spdx-to-cdx.mts'; +import { spdxToCdxBom } from './spdx-to-cdx.ts'; import type { SPDX23 } from './types/bom/spdx-2.3.schema.js'; -import type { Component, Dependency } from './types/index.mts'; +import type { Component, Dependency } from './types/index.ts'; function buildSpdxAndConvert(spdx: Partial) { const baseSpdx: SPDX23 = { diff --git a/src/spdx-to-cdx.mts b/src/spdx-to-cdx.ts similarity index 100% rename from src/spdx-to-cdx.mts rename to src/spdx-to-cdx.ts diff --git a/src/trim-cdx-bom.test.mts b/src/trim-cdx-bom.test.ts similarity index 95% rename from src/trim-cdx-bom.test.mts rename to src/trim-cdx-bom.test.ts index 1c826d0..fd826e9 100644 --- a/src/trim-cdx-bom.test.mts +++ b/src/trim-cdx-bom.test.ts @@ -1,7 +1,7 @@ import { test, describe } from 'node:test'; import { strict as assert } from 'node:assert'; -import { trimCdxBom } from './trim-cdx-bom.mts'; -import type { CdxBom } from './types/index.mts'; +import { trimCdxBom } from './trim-cdx-bom.ts'; +import type { CdxBom } from './types/index.ts'; import { Enums } from '@cyclonedx/cyclonedx-library'; describe('trimCdxBom', () => { diff --git a/src/trim-cdx-bom.mts b/src/trim-cdx-bom.ts similarity index 92% rename from src/trim-cdx-bom.mts rename to src/trim-cdx-bom.ts index 5be5e12..043b6f1 100644 --- a/src/trim-cdx-bom.mts +++ b/src/trim-cdx-bom.ts @@ -1,4 +1,4 @@ -import type { CdxBom } from './types/index.mts'; +import type { CdxBom } from './types/index.ts'; /** * Creates a trimmed copy of a CycloneDX BOM by removing SBOM data not necessary for EOL scanning. diff --git a/src/types/eol-scan.mts b/src/types/eol-scan.ts similarity index 96% rename from src/types/eol-scan.mts rename to src/types/eol-scan.ts index 39e24bc..32f0512 100644 --- a/src/types/eol-scan.mts +++ b/src/types/eol-scan.ts @@ -1,4 +1,4 @@ -import type { CdxBom } from './index.mjs'; +import type { CdxBom } from './index.js'; export interface CveStats { cveId: string; diff --git a/src/types/index.mts b/src/types/index.ts similarity index 100% rename from src/types/index.mts rename to src/types/index.ts