diff --git a/package.json b/package.json index 73122fb..5e4b48f 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "portier", "version": "0.4.3", "description": "Portier client for Node.js", + "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", "repository": { diff --git a/src/client.ts b/src/client.ts index 1668662..e01dab7 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,9 +1,9 @@ -import url from "url"; +import url from "node:url"; import jwa from "jwa"; import jwkToPem from "jwk-to-pem"; -import querystring from "querystring"; -import AbstractStore from "./store"; -import MemoryStore from "./stores/memory"; +import querystring from "node:querystring"; +import AbstractStore from "./store.js"; +import MemoryStore from "./stores/memory.js"; const rs256 = jwa("RS256"); diff --git a/src/index.ts b/src/index.ts index 3fb1333..be998cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -export { default as PortierClient } from "./client"; -export { default as AbstractStore } from "./store"; -export { default as MemoryStore } from "./stores/memory"; -export { default as normalize } from "./normalize"; +export { default as PortierClient } from "./client.js"; +export { default as AbstractStore } from "./store.js"; +export { default as MemoryStore } from "./stores/memory.js"; +export { default as normalize } from "./normalize.js"; diff --git a/src/normalize.ts b/src/normalize.ts index bb10e01..b2e4be4 100644 --- a/src/normalize.ts +++ b/src/normalize.ts @@ -1,5 +1,5 @@ -import { isIPv4 } from "net"; -import { domainToASCII } from "url"; +import { isIPv4 } from "node:net"; +import { domainToASCII } from "node:url"; /** * Normalize an email address. diff --git a/src/store.ts b/src/store.ts index d854d0b..5da4b2a 100644 --- a/src/store.ts +++ b/src/store.ts @@ -1,4 +1,4 @@ -import crypto from "crypto"; +import crypto from "node:crypto"; /** Abstract base class for store implementations. */ export default abstract class AbstractStore { diff --git a/src/stores/memory.ts b/src/stores/memory.ts index 7cab9d4..99d66d0 100644 --- a/src/stores/memory.ts +++ b/src/stores/memory.ts @@ -1,4 +1,4 @@ -import AbstractStore from "../store"; +import AbstractStore from "../store.js"; /** An in-memory store implementation. */ export default class MemoryStore extends AbstractStore { diff --git a/src/stores/redis.ts b/src/stores/redis.ts index 13b4ce5..4de314a 100644 --- a/src/stores/redis.ts +++ b/src/stores/redis.ts @@ -1,4 +1,4 @@ -import AbstractStore from "../store"; +import AbstractStore from "../store.js"; import type { RedisClientType } from "@redis/client"; /** diff --git a/test.js b/test.js index 67a15ab..d8aa593 100644 --- a/test.js +++ b/test.js @@ -1,5 +1,5 @@ -const test = require("tape"); -const { normalize } = require("."); +import test from "tape"; +import { normalize } from "./dist/index.js"; test("normalize", (t) => { const valid = [ diff --git a/tsconfig.json b/tsconfig.json index cecde13..609397a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,22 @@ { "compilerOptions": { - "target": "ES2017", - "module": "commonjs", - "lib": ["ES2017"], + "lib": ["es2023"], + "module": "node16", + "target": "es2022", + + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "moduleResolution": "node16", + "declaration": true, "rootDir": "src", "outDir": "dist", - "strict": true, + "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "esModuleInterop": true + "noFallthroughCasesInSwitch": true } }