From 1139f1dea8e2590676ce1b4379a3b4ebffd4241a Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Wed, 13 May 2026 13:49:06 -0700 Subject: [PATCH] Export as ESM --- package.json | 6 ++---- src/format.bench.ts | 2 +- src/format.spec.ts | 2 +- src/parse.bench.ts | 2 +- src/parse.spec.ts | 2 +- tsconfig.json | 4 ++-- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index e18a931..d117162 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "basic-auth", "version": "2.0.1", - "description": "node.js basic auth parser", + "description": "Basic auth parser", "keywords": [ "basic", "auth", @@ -10,10 +10,8 @@ ], "repository": "jshttp/basic-auth", "license": "MIT", - "type": "commonjs", + "type": "module", "exports": "./dist/index.js", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", "files": [ "dist/" ], diff --git a/src/format.bench.ts b/src/format.bench.ts index 71121fc..1a239d0 100644 --- a/src/format.bench.ts +++ b/src/format.bench.ts @@ -1,5 +1,5 @@ import { bench, describe } from 'vitest'; -import { format } from './index'; +import { format } from './index.js'; describe('format', () => { bench('format with simple credentials', () => { diff --git a/src/format.spec.ts b/src/format.spec.ts index 158d419..a613e76 100644 --- a/src/format.spec.ts +++ b/src/format.spec.ts @@ -1,5 +1,5 @@ import { describe, it, assert } from 'vitest'; -import { format } from './index'; +import { format } from './index.js'; describe('format(credentials)', function () { describe('arguments', function () { diff --git a/src/parse.bench.ts b/src/parse.bench.ts index e268573..d2a2511 100644 --- a/src/parse.bench.ts +++ b/src/parse.bench.ts @@ -1,5 +1,5 @@ import { describe, bench } from 'vitest'; -import { parse } from './index'; +import { parse } from './index.js'; describe('parse', () => { bench('basic auth header', () => { diff --git a/src/parse.spec.ts b/src/parse.spec.ts index 4f3f692..6347ea1 100644 --- a/src/parse.spec.ts +++ b/src/parse.spec.ts @@ -1,5 +1,5 @@ import { describe, it, assert } from 'vitest'; -import { parse } from './index'; +import { parse } from './index.js'; describe('parse(string)', function () { describe('with undefined string', function () { diff --git a/tsconfig.json b/tsconfig.json index 8eef991..4a23eec 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "extends": "@borderless/ts-scripts/configs/tsconfig.json", "compilerOptions": { - "target": "ES2022", - "lib": ["ES2023"], + "target": "es2023", + "lib": ["es2023"], "rootDir": "src", "outDir": "dist", "module": "nodenext",