diff --git a/README.md b/README.md index d1a088a..b3716dc 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ npm install @epic-web/client-hints ## The Problem -Sometimes your server rendered code needs to know something about the client that -the browser doesn't send. For example, the server might need to know the user's -preferred language, or whether the user prefers light or dark mode. +Sometimes your server rendered code needs to know something about the client +that the browser doesn't send. For example, the server might need to know the +user's preferred language, or whether the user prefers light or dark mode. For some of this you should have user preferences which can be persisted in a cookie or a database, but you can't do this for first-time visitors. All you can diff --git a/src/color-scheme.ts b/src/color-scheme.ts index b0d1437..5639fe6 100644 --- a/src/color-scheme.ts +++ b/src/color-scheme.ts @@ -1,4 +1,4 @@ -import { type ClientHint } from './utils' +import { type ClientHint } from './utils.js' export const clientHint = { cookieName: 'CH-prefers-color-scheme', diff --git a/src/index.ts b/src/index.ts index 11cae37..73dec66 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { ClientHint, ClientHintsValue } from './utils' +import { ClientHint, ClientHintsValue } from './utils.js' export type { ClientHint } diff --git a/src/reduced-motion.ts b/src/reduced-motion.ts index fecb734..2a5971c 100644 --- a/src/reduced-motion.ts +++ b/src/reduced-motion.ts @@ -1,4 +1,4 @@ -import { type ClientHint } from './utils' +import { type ClientHint } from './utils.js' export const clientHint = { cookieName: 'CH-reduced-motion', diff --git a/src/time-zone.ts b/src/time-zone.ts index 897718a..d57e867 100644 --- a/src/time-zone.ts +++ b/src/time-zone.ts @@ -1,4 +1,4 @@ -import { type ClientHint } from './utils' +import { type ClientHint } from './utils.js' export const clientHint = { cookieName: 'CH-time-zone', diff --git a/test/index.test.ts b/test/index.test.ts index 78f6bcd..afa02b8 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -1,8 +1,8 @@ import { test } from 'node:test' -import { getHintUtils } from '../src' -import { clientHint as colorSchemeHint } from '../src/color-scheme' -import { clientHint as timeZoneHint } from '../src/time-zone' -import { clientHint as reducedMotionHint } from '../src/reduced-motion' +import { getHintUtils } from '../src/index.js' +import { clientHint as colorSchemeHint } from '../src/color-scheme.js' +import { clientHint as timeZoneHint } from '../src/time-zone.js' +import { clientHint as reducedMotionHint } from '../src/reduced-motion.js' import assert from 'node:assert' test('client script works', () => {