Skip to content

Commit

Permalink
ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBarba committed Nov 27, 2024
1 parent 01afee9 commit b41b66b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
"version": "12.0.0",
"description": "Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.",
"author": "Andrew Barba <[email protected]>",
"license": "MIT",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"exports": {
".": "./dist/index.js"
},
"engines": {
"node": ">=20"
},
Expand Down
4 changes: 2 additions & 2 deletions src/apns.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { EventEmitter } from "node:events"
import { type PrivateKey, createSigner } from "fast-jwt"
import { type Dispatcher, Pool } from "undici"
import { ApnsError, type ApnsResponseError, Errors } from "./errors"
import { type Notification, Priority } from "./notifications/notification"
import { ApnsError, type ApnsResponseError, Errors } from "./errors.js"
import { type Notification, Priority } from "./notifications/notification.js"

// APNS version
const API_VERSION = 3
Expand Down
2 changes: 1 addition & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Notification } from "./notifications/notification"
import type { Notification } from "./notifications/notification.js"

export enum Errors {
badCertificate = "BadCertificate",
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 * from "./apns"
export * from "./errors"
export * from "./notifications/notification"
export * from "./notifications/silent-notification"
export * from "./apns.js"
export * from "./errors.js"
export * from "./notifications/notification.js"
export * from "./notifications/silent-notification.js"
4 changes: 2 additions & 2 deletions src/notifications/notification.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Priority } from "./constants/priority"
import { PushType } from "./constants/push-type"
import { Priority } from "./constants/priority.js"
import { PushType } from "./constants/push-type.js"

export { PushType, Priority }

Expand Down
2 changes: 1 addition & 1 deletion src/notifications/silent-notification.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Notification, type NotificationOptions, Priority, PushType } from "./notification"
import { Notification, type NotificationOptions, Priority, PushType } from "./notification.js"

export class SilentNotification extends Notification {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion test/apns2.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "dotenv/config"
import { assert } from "chai"
import { beforeAll, describe, it } from "vitest"
import { ApnsClient, Errors, Notification, SilentNotification } from "../src"
import { ApnsClient, Errors, Notification, SilentNotification } from "../src/index.js"

describe("apns", () => {
const deviceToken = process.env.APNS_PUSH_TOKEN ?? ""
Expand Down

0 comments on commit b41b66b

Please sign in to comment.