Skip to content

Commit

Permalink
Use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
stephank committed Nov 10, 2023
1 parent b1c3884 commit e6305bb
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 21 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
@@ -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");

Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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";
4 changes: 2 additions & 2 deletions src/normalize.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";

/** Abstract base class for store implementations. */
export default abstract class AbstractStore {
Expand Down
2 changes: 1 addition & 1 deletion src/stores/memory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AbstractStore from "../store";
import AbstractStore from "../store.js";

/** An in-memory store implementation. */
export default class MemoryStore extends AbstractStore {
Expand Down
2 changes: 1 addition & 1 deletion src/stores/redis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AbstractStore from "../store";
import AbstractStore from "../store.js";
import type { RedisClientType } from "@redis/client";

/**
Expand Down
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
18 changes: 12 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit e6305bb

Please sign in to comment.