From ac6ff6c46a09845922d493a8cc54ac542fdc2ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Bj=C3=B8rn=20Michelsen?= Date: Fri, 12 Jul 2024 23:34:47 -0700 Subject: [PATCH] fix(esm): add .js extension to imports This will output ESM valid imports. --- src/compare.ts | 4 ++-- src/compareVersions.ts | 2 +- src/index.ts | 10 +++++----- src/satisfies.ts | 4 ++-- src/validate.ts | 2 +- tsconfig.json | 34 ++++++++++++++++------------------ 6 files changed, 27 insertions(+), 29 deletions(-) diff --git a/src/compare.ts b/src/compare.ts index 9bca71f..0b63734 100644 --- a/src/compare.ts +++ b/src/compare.ts @@ -1,5 +1,5 @@ -import { compareVersions } from './compareVersions'; -import { CompareOperator } from './utils'; +import { compareVersions } from './compareVersions.js'; +import { CompareOperator } from './utils.js'; /** * Compare [semver](https://semver.org/) version strings using the specified operator. diff --git a/src/compareVersions.ts b/src/compareVersions.ts index 3321f66..589cbfd 100644 --- a/src/compareVersions.ts +++ b/src/compareVersions.ts @@ -1,4 +1,4 @@ -import { compareSegments, validateAndParse } from './utils'; +import { compareSegments, validateAndParse } from './utils.js'; /** * Compare [semver](https://semver.org/) version strings to find greater, equal or lesser. diff --git a/src/index.ts b/src/index.ts index 6a08240..b2f8aab 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ -export { compare } from './compare'; -export { compareVersions } from './compareVersions'; -export { satisfies } from './satisfies'; -export { CompareOperator } from './utils'; -export { validate, validateStrict } from './validate'; +export { compare } from './compare.js'; +export { compareVersions } from './compareVersions.js'; +export { satisfies } from './satisfies.js'; +export { CompareOperator } from './utils.js'; +export { validate, validateStrict } from './validate.js'; diff --git a/src/satisfies.ts b/src/satisfies.ts index 02a9d18..66cb171 100644 --- a/src/satisfies.ts +++ b/src/satisfies.ts @@ -1,5 +1,5 @@ -import { compare } from './compare'; -import { CompareOperator, compareSegments, validateAndParse } from './utils'; +import { compare } from './compare.js'; +import { CompareOperator, compareSegments, validateAndParse } from './utils.js'; /** * Match [npm semver](https://docs.npmjs.com/cli/v6/using-npm/semver) version range. diff --git a/src/validate.ts b/src/validate.ts index db69255..ef91f05 100644 --- a/src/validate.ts +++ b/src/validate.ts @@ -1,4 +1,4 @@ -import { semver } from './utils'; +import { semver } from './utils.js'; /** * Validate [semver](https://semver.org/) version strings. diff --git a/tsconfig.json b/tsconfig.json index b9cfe1b..d46c9d7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,18 @@ { - "compilerOptions": { - "declaration": true, - "esModuleInterop": true, - "module": "UMD", - "noUnusedLocals": true, - "noUnusedParameters": true, - "outDir": ".", - "sourceMap": true, - "strict": true, - "target": "ES5" - }, - "include": [ - "src/index.ts" - ], - "exclude": [ - "./src/test/**/*", - "node_modules" - ] + "compilerOptions": { + "declaration": true, + "esModuleInterop": true, + "module": "UMD", + "noUnusedLocals": true, + "noUnusedParameters": true, + "outDir": ".", + "sourceMap": true, + "strict": true, + "target": "ES5" + }, + "include": ["src/index.ts"], + "exclude": ["./src/test/**/*", "node_modules"], + "ts-node": { + "experimentalResolver": true + } }